Hmbown/CodeWhale · error · RegistryError

unknown_computer

unknown_computer

Error message

no computer registered with id "${id}". Use computer_list.

What it means

registry.get looks up a computer entry by id in the persisted registry; when no entry with that id exists it throws RegistryError with code 'unknown_computer' and points the caller at computer_list. The registry file exists and parsed fine — the id simply does not match any registered computer.

Solutions

  1. Call computer_list (or list()) and use one of the ids it returns.
  2. If no computer exists, register one first via the registry's add/register path, then get it.
  3. Fix the stale active pointer if active() is the thrower — set active to a currently registered id.
  4. Verify you are reading the expected registry (same user/profile/machine) if ids are shared across sessions.

Example fix

// before
const computer = registry.get('my-desktop');
// after
const reg = registry.list();
const id = reg.computers['my-desktop'] ? 'my-desktop' : Object.keys(reg.computers)[0];
if (!id) throw new Error('no computers registered — run computer_use_register first');
const computer = registry.get(id);
Defensive patterns

Strategy: validation

Validate before calling

const reg = registry.list();
const ids = Object.keys(reg.computers);
if (!ids.includes(id)) throw new Error(`unknown computer "${id}"; registered: ${ids.join(', ')}`);

Type guard

const isUnknownComputer = (e) =>
  e != null && e.code === 'unknown_computer';

Try / catch

try {
  return registry.get(id);
} catch (e) {
  if (isUnknownComputer(e)) {
    const reg = registry.list();
    return registry.get(Object.keys(reg.computers)[0]); // or prompt registration
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling get(id) or active() with an id that was never registered, an id from a deleted registration, a typo'd/renamed computer id, or a registry file from a different machine/profile that lacks the id; active() also throws this when the stored active id is stale.

Common situations: Registry reset or moved between machines leaving ids dangling; renaming a computer then using the old id in scripts; calling get before ever registering a computer; concurrent runs where another process deregistered the entry.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/plugins/computer-use/src/registry.mjs:62

  fs.mkdirSync(stateDir(), { recursive: true });
  const tmp = registryPath() + ".tmp";
  fs.writeFileSync(tmp, JSON.stringify(reg, null, 2) + "\n");
  fs.renameSync(tmp, registryPath());
  return reg;
}

export function list() {
  const reg = load();
  // Keep the local entry truthful even if the state file is stale.
  reg.computers.local = { ...(reg.computers.local ?? {}), ...localEntry() };
  if (!reg.computers[reg.active]) reg.active = "local";
  return reg;
}

export function get(id) {
  const reg = list();
  const c = reg.computers[id];
  if (!c) throw new RegistryError("unknown_computer", `no computer registered with id "${id}". Use computer_list.`);
  return c;
}

export function active() { return get(list().active); }

/** Switch the active computer. Returns the computer entry. */
export function switchTo(id) {
  const c = get(id); // throws unknown_computer
  const reg = load();
  reg.active = c.id;
  save(reg);
  return c;
}

/** Register or update a computer. Returns the entry. */
export function register({ id, transport, label, ...rest }) {
  if (!id || !ID_RE.test(id)) throw new RegistryError("invalid_id", "computer id must match " + ID_RE);
  if (!["local", "ssh", "hdc", "docker"].includes(transport)) {

View on GitHub (pinned to 73e0f67d83)