{"record":{"id":"5ded88600eecd19a","repo":"Hmbown/CodeWhale","slug":"invalid-transport","errorCode":"invalid_transport","errorMessage":"transport must be one of: local, ssh, hdc, docker","messagePattern":"transport must be one of: local, ssh, hdc, docker","errorType":"validation","errorClass":"RegistryError","httpStatus":null,"severity":"error","filePath":"crates/tui/plugins/computer-use/src/registry.mjs","lineNumber":81,"sourceCode":"  return c;\n}\n\nexport function active() { return get(list().active); }\n\n/** Switch the active computer. Returns the computer entry. */\nexport function switchTo(id) {\n  const c = get(id); // throws unknown_computer\n  const reg = load();\n  reg.active = c.id;\n  save(reg);\n  return c;\n}\n\n/** Register or update a computer. Returns the entry. */\nexport function register({ id, transport, label, ...rest }) {\n  if (!id || !ID_RE.test(id)) throw new RegistryError(\"invalid_id\", \"computer id must match \" + ID_RE);\n  if (![\"local\", \"ssh\", \"hdc\", \"docker\"].includes(transport)) {\n    throw new RegistryError(\"invalid_transport\", \"transport must be one of: local, ssh, hdc, docker\");\n  }\n  if (id === \"local\" && transport !== \"local\") {\n    throw new RegistryError(\"reserved_id\", '\"local\" is reserved for this machine');\n  }\n  if (transport === \"ssh\") {\n    if (!rest.host || !/^[A-Za-z0-9._-]+$/.test(rest.host)) {\n      throw new RegistryError(\"invalid_host\", \"ssh computers need a valid host (letters, digits, dot, dash, underscore)\");\n    }\n    if (rest.port != null && (!Number.isInteger(rest.port) || rest.port < 1 || rest.port > 65535)) {\n      throw new RegistryError(\"invalid_port\", \"port must be an integer in 1..65535\");\n    }\n    if (rest.user != null && !/^[a-zA-Z0-9._-]+$/.test(rest.user)) {\n      throw new RegistryError(\"invalid_user\", \"user must be a plain name\");\n    }\n  }\n  if (transport === \"hdc\") {\n    if (rest.target != null && !/^[A-Za-z0-9._-]*$/.test(rest.target)) {\n      throw new RegistryError(\"invalid_target\", \"hdc target key contains invalid characters\");","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/plugins/computer-use/src/registry.mjs#L63-L99","documentation":"RegistryError \"invalid_transport\": register() only accepts the four transport kinds local, ssh, hdc, docker. Anything else — including close variants like \"localhost\", \"SSH\", or \"adb\" — is rejected because there is no connector implementation for it. The transport decides how the computer-use plugin actually reaches the machine, so an unknown value cannot be registered.","triggerScenarios":"register({ id: \"x\", transport: \"localhost\" }); register({ id: \"x\", transport: \"SSH\" }) (case-sensitive); register({ id: \"x\", transport: \"adb\" }) when the device is actually HarmonyOS and hdc is meant.","commonSituations":"Typo in a config file; mixing up adb and hdc when configuring an Android/HarmonyOS device; copying an example that uses a different plugin's transport vocabulary; uppercase from a templating layer.","solutions":["Use exactly one of: \"local\", \"ssh\", \"hdc\", \"docker\" (lowercase).","For an Android device check whether this build supports it via hdc only; switch from \"adb\" to \"hdc\" or use ssh/docker instead.","Trim/lowercase any externally supplied transport string before calling register().","Update config files or templates that reference a transport name not in this list."],"exampleFix":"// before\nregister({ id: \"phone\", transport: \"adb\" });\n// after\nregister({ id: \"phone\", transport: \"hdc\", target: \"<serial>\" });","handlingStrategy":"validation","validationCode":"const TRANSPORTS = [\"local\", \"ssh\", \"hdc\", \"docker\"];\nif (!TRANSPORTS.includes(transport)) throw new Error(`transport must be one of: ${TRANSPORTS.join(\", \")}`);","typeGuard":"const isTransport = (t) => t === \"local\" || t === \"ssh\" || t === \"hdc\" || t === \"docker\";","tryCatchPattern":"try {\n  register(cfg);\n} catch (e) {\n  if (e?.code === \"invalid_transport\") console.error(`Unsupported transport \"${cfg.transport}\"; use local|ssh|hdc|docker`);\n  throw e;\n}","preventionTips":["Always lowercase and trim transport strings from config/env","Remember adb is not supported — HarmonyOS devices use hdc","Keep transport names centralized in one constant, not inlined strings"],"tags":["validation","registry","enum","javascript"],"backgroundTag":"invalid-enum-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}