{"record":{"id":"be986e0da63f6740","repo":"stablyai/orca","slug":"unsupported-host-args-hostid","errorCode":null,"errorMessage":"Unsupported host: ${args.hostId}","messagePattern":"Unsupported host: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/repos.ts","lineNumber":1433,"sourceCode":"      notifyReposChanged(mainWindow)\n      return result\n    }\n  )\n\n  ipcMain.handle(\n    'projectHostSetups:setupExistingFolder',\n    async (\n      _event,\n      rawArgs: ProjectHostSetupExistingFolderArgs\n    ): Promise<ProjectHostSetupResult> => {\n      const args = parseProjectGroupIpcArgs(\n        ProjectHostSetupExistingFolderIpcArgs,\n        rawArgs,\n        'project_host_setup_invalid_args'\n      )\n      const parsedHost = parseExecutionHostId(args.hostId)\n      if (!parsedHost) {\n        throw new Error(`Unsupported host: ${args.hostId}`)\n      }\n      const result =\n        parsedHost.kind === 'local'\n          ? await addLocalRepoFromPath(store, args.path, args.kind)\n          : parsedHost.kind === 'ssh'\n            ? await addRemoteRepoFromPath(store, {\n                connectionId: parsedHost.targetId,\n                remotePath: args.path,\n                displayName: args.displayName,\n                kind: args.kind\n              })\n            : {\n                error:\n                  'Runtime hosts must be set up through the runtime projectHostSetup.setupExistingFolder RPC.'\n              }\n      if ('error' in result) {\n        throw new Error(result.error)\n      }","sourceCodeStart":1415,"sourceCodeEnd":1451,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/repos.ts#L1415-L1451","documentation":"Thrown by the projectHostSetups:setupExistingFolder IPC handler when parseExecutionHostId(args.hostId) returns null. parseExecutionHostId accepts exactly three forms: the literal local id, 'ssh:<encodeURIComponent(targetId)>', or 'runtime:<encodeURIComponent(environmentId)>'. Any other string (including a bare SSH target id, an empty runtime: prefix, or malformed URI encoding) yields null.","triggerScenarios":"Passing a raw SSH connection id without the 'ssh:' prefix and encodeURIComponent; passing 'runtime:' with an empty encoded segment; passing a display label or alias instead of the canonical host id; URI-encoding errors that make decodeURIComponent throw.","commonSituations":"Renderer builds the host id manually and forgets the prefix or the encoding; a host id is round-tripped through a component that double-decodes it; switching from the old bare-target id scheme to the prefixed scheme without migration.","solutions":["Always construct host ids with the shared helpers toSshExecutionHostId / toRuntimeExecutionHostId, never by string concatenation.","Validate the host id with parseExecutionHostId on the renderer before invoking the IPC.","If you hold a raw target id, wrap it: toSshExecutionHostId(targetId) before sending.","Ensure the encoded segment is non-empty and produced by encodeURIComponent."],"exampleFix":"// before\nipc.invoke('projectHostSetups:setupExistingFolder', { hostId: sshTargetId, path })\n\n// after\nimport { toSshExecutionHostId } from '@shared/execution-host'\nipc.invoke('projectHostSetups:setupExistingFolder', {\n  hostId: toSshExecutionHostId(sshTargetId),\n  path,\n})","handlingStrategy":"type-guard","validationCode":"import { parseExecutionHostId, toSshExecutionHostId, toRuntimeExecutionHostId } from '@shared/execution-host'\n\nfunction buildHostId(host: { kind: 'local' } | { kind: 'ssh'; targetId: string } | { kind: 'runtime'; environmentId: string }): string {\n  if (host.kind === 'local') return 'local' // LOCAL_EXECUTION_HOST_ID\n  if (host.kind === 'ssh') return toSshExecutionHostId(host.targetId)\n  return toRuntimeExecutionHostId(host.environmentId)\n}\n\nconst hostId = buildHostId(host)\nif (!parseExecutionHostId(hostId)) throw new Error('Refusing to call IPC with unparseable host id')\nipc.invoke('projectHostSetups:setupExistingFolder', { hostId, path })","typeGuard":"import { parseExecutionHostId, type ParsedExecutionHost } from '@shared/execution-host'\n\nfunction isValidHostId(value: unknown): value is string {\n  return typeof value === 'string' && parseExecutionHostId(value) !== null\n}","tryCatchPattern":"try {\n  await ipc.invoke('projectHostSetups:setupExistingFolder', { hostId, path })\n} catch (e) {\n  if (/Unsupported host/.test((e as Error).message)) {\n    showError('This host type is not supported for folder setup.')\n  } else throw e\n}","preventionTips":["Never build host ids by concatenation; use toSshExecutionHostId / toRuntimeExecutionHostId.","Validate with parseExecutionHostId on the renderer before any host-scoped IPC.","Keep host context bound to the row that originated the action."],"tags":["ipc","repos","execution-host","validation","encoding"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}