{"record":{"id":"1d255916153a831b","repo":"stablyai/orca","slug":"invalid-localhost-label-field","errorCode":null,"errorMessage":"Invalid localhost label ${field}.","messagePattern":"Invalid localhost label (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/localhost-worktree-labels.ts","lineNumber":91,"sourceCode":"  if (!value || typeof value !== 'object') {\n    throw new Error('Invalid localhost label route.')\n  }\n  const candidate = value as Record<string, unknown>\n  const targetUrl = readRequiredString(candidate.targetUrl, 'targetUrl')\n  const projectName = readRequiredString(candidate.projectName, 'projectName')\n  const worktreeName = readRequiredString(candidate.worktreeName, 'worktreeName')\n  return {\n    targetUrl,\n    projectName,\n    worktreeName,\n    repoId: readOptionalString(candidate.repoId),\n    worktreeId: readOptionalString(candidate.worktreeId)\n  }\n}\n\nfunction readRequiredString(value: unknown, field: string): string {\n  if (typeof value !== 'string' || value.trim().length === 0) {\n    throw new Error(`Invalid localhost label ${field}.`)\n  }\n  return value.trim()\n}\n\nfunction readOptionalString(value: unknown): string | null {\n  return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null\n}\n","sourceCodeStart":73,"sourceCodeEnd":99,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/localhost-worktree-labels.ts#L73-L99","documentation":"Thrown by readRequiredString when a required field of the localhost label route (targetUrl, projectName, or worktreeName) is not a string or is empty/whitespace-only after trim. The field name is interpolated so the message identifies the offending field (e.g. 'Invalid localhost label targetUrl.'). This enforces that the three core route fields are present and non-empty.","triggerScenarios":"Passing a route object where targetUrl, projectName, or worktreeName is missing, empty, whitespace-only, or a non-string type. The object-level guard (1216) passed, but one of the required fields is invalid.","commonSituations":"Renderer sends the route with a blank worktree name when no worktree is selected. projectName is undefined for a non-git folder. targetUrl built from missing host/port. A form field left empty but submitted.","solutions":["Populate all three required fields (targetUrl, projectName, worktreeName) with non-empty trimmed strings before registering.","Disable the register action in the UI until all required fields are filled.","Trim and validate each field on the caller side."],"exampleFix":"// before\nawait ipc.call('localhostLabel:register', { targetUrl, projectName: '', worktreeName })\n\n// after\nif (!targetUrl || !projectName || !worktreeName) throw new Error('All fields required')\nawait ipc.call('localhostLabel:register', { targetUrl, projectName, worktreeName })","handlingStrategy":"validation","validationCode":"function requireString(value: unknown, field: string): string {\n  if (typeof value !== 'string' || value.trim().length === 0) {\n    throw new Error(`Invalid ${field}`)\n  }\n  return value.trim()\n}","typeGuard":"function isNonEmptyTrimmedString(value: unknown): value is string {\n  return typeof value === 'string' && value.trim().length > 0\n}","tryCatchPattern":null,"preventionTips":["Disable the register action until targetUrl, projectName, and worktreeName are all non-empty.","Trim and validate each required field before sending.","Never submit a form with blank required fields."],"tags":["validation","required-field","localhost","ipc"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}