stablyai/orca · error · Error
Invalid localhost label route.
Error message
Invalid localhost label route.
What it means
Thrown by parseRegisterArgs when the IPC argument value is not a non-null object. parseRegisterArgs expects a LocalhostWorktreeLabelRoute-shaped object (targetUrl, projectName, worktreeName, repoId?, worktreeId?). If the renderer sends a primitive, null, or omits the argument entirely, the object check fails before any field validation.
Source
Thrown at src/main/ipc/localhost-worktree-labels.ts:74
}
const advertisedUrl = 'advertisedUrl' in port ? port.advertisedUrl : undefined
if (!advertisedUrl) {
return false
}
try {
return normalizeLocalhostHostname(new URL(advertisedUrl).hostname) === targetHost
} catch {
return false
}
})
if (!matches) {
throw new Error('Localhost label target is not an allowed workspace port.')
}
}
function parseRegisterArgs(value: unknown): LocalhostWorktreeLabelRoute {
if (!value || typeof value !== 'object') {
throw new Error('Invalid localhost label route.')
}
const candidate = value as Record<string, unknown>
const targetUrl = readRequiredString(candidate.targetUrl, 'targetUrl')
const projectName = readRequiredString(candidate.projectName, 'projectName')
const worktreeName = readRequiredString(candidate.worktreeName, 'worktreeName')
return {
targetUrl,
projectName,
worktreeName,
repoId: readOptionalString(candidate.repoId),
worktreeId: readOptionalString(candidate.worktreeId)
}
}
function readRequiredString(value: unknown, field: string): string {
if (typeof value !== 'string' || value.trim().length === 0) {
throw new Error(`Invalid localhost label ${field}.`)
}View on GitHub (pinned to 1136503c6a)
Solutions
- Pass a single object containing targetUrl, projectName, and worktreeName (plus optional repoId/worktreeId) as the IPC argument.
- Verify the renderer's invoke call wraps the payload as one object.
- Add a TypeScript type at the call boundary so shape drift is caught at compile time.
Example fix
// before
await ipc.call('localhostLabel:register', targetUrl, projectName, worktreeName)
// after
await ipc.call('localhostLabel:register', { targetUrl, projectName, worktreeName }) Defensive patterns
Strategy: type-guard
Validate before calling
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw new Error('Route argument must be an object')
} Type guard
function isRouteObject(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value)
} Prevention
- Pass the route as a single object argument, not positional values.
- Type the IPC call argument at the boundary so shape drift fails to compile.
- Double-check refactored call sites preserve the object wrapper.
When it happens
Trigger: Calling the localhost-worktree-labels register IPC with a primitive argument (string/number), null, undefined, or an array. The handler then reads candidate.targetUrl etc., but the top-level object guard rejects first.
Common situations: Renderer sends the route fields as separate positional args instead of a single object. A serialization bug flattens the object. The call site was refactored and the argument shape drifted.
Related errors
- Localhost label target is not a valid URL.
- Invalid localhost label ${field}.
- Selected file is not a markdown document.
- ${label} is required
- ${label} is required
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/20f07c67d72b97bd.
Report an issue: GitHub.