Skip to content

[BUG] Kernel Panic - decision.plan.join is not a function #9

@youyoulyz

Description

@youyoulyz

Issue: Kernel Panic - decision.plan.join is not a function

Description

The agent crashes during the execution loop when attempting to log the plan. This occurs when the LLM provider (specifically observed with ollama/qwen3.5:27b) returns a decision.plan value that is not an Array (e.g., a String or null), causing the .join(" -> ") call to fail.

Traceback

TypeError: decision.plan.join is not a function. (In 'decision.plan.join(" -> ")', 'decision.plan.join' is undefined)
      at runAgent (/mnt/luyuzhou/droidclaw/src/kernel.ts:389:42)

Steps to Reproduce

  1. Run bun run src/kernel.ts.
  2. Provide a goal (e.g., "Open telegram and send hello to Cee").
  3. Wait for the agent to move to Step 2.
  4. If the LLM returns a non-array plan field in its JSON response, the process exits.

Suggested Fix

We should verify that decision.plan is an array before attempting to join it, or cast it to an array if it's a string.

File: src/kernel.ts
Line: 389

// Proposed defensive check
if (decision.plan) {
  const planOutput = Array.isArray(decision.plan) 
    ? decision.plan.join(" -> ") 
    : decision.plan;
  console.log(`Plan: ${planOutput}`);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions