Hmbown/CodeWhale · error · Error

trajectory_not_found

trajectory_not_found

Error message

no trajectories on this machine yet — start one with trajectory {action:"start"}

What it means

resolveTrajectory: the trajectories directory has no recorded trajectories yet (or is unreadable), so neither 'latest' nor any traj-*.jsonl id can be resolved; ids escaping the directory are also refused rather than read. The absence of any recording is the condition at fault, not a malformed id.

Solutions

  1. Start a trajectory first: trajectory {action:"start"}.
  2. Pass id:"latest" to operate on the most recent trajectory if one exists on another machine-synced store.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/tui/plugins/computer-use/src/trajectory.mjs:82 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/f877ed7c107da279. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/plugins/computer-use/src/trajectory.mjs:82

        const full = path.join(trajectoriesDir(), name);
        const stat = fs.statSync(full);
        return { id: name, bytes: stat.size, modified: stat.mtime.toISOString(), turns: countCalls(full) };
      });
  } catch { return []; }
}

/**
 * Resolve an id ("latest" or a traj-*.jsonl basename) to a file inside the
 * trajectories dir. Anything that escapes the directory is refused, not read.
 */
export function resolveTrajectory(id) {
  const dir = trajectoriesDir();
  const bad = (message) => Object.assign(new Error(message), { code: "bad_args" });
  const missing = (message) => Object.assign(new Error(message), { code: "trajectory_not_found" });
  let name = typeof id === "string" && id.trim() && id !== "latest" ? id.trim() : null;
  if (!name) {
    const recent = listTrajectories(1);
    if (!recent.length) throw missing("no trajectories on this machine yet — start one with trajectory {action:\"start\"}");
    name = recent[0].id;
  }
  if (name.includes("/") || name.includes("\\") || name.startsWith(".")) throw bad("trajectory id must be a traj-*.jsonl name from trajectory status");
  const file = path.resolve(dir, name);
  if (path.dirname(file) !== path.resolve(dir)) throw bad("trajectory id must stay inside the trajectories directory");
  if (!fs.existsSync(file)) throw missing(`no trajectory named "${name}" (see trajectory {action:"status"})`);
  return file;
}

View on GitHub (pinned to 73e0f67d83)