stablyai/orca · error · Error
Invalid localhost label ${field}.
Error message
Invalid localhost label ${field}. What it means
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.
Source
Thrown at src/main/ipc/localhost-worktree-labels.ts:91
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}.`)
}
return value.trim()
}
function readOptionalString(value: unknown): string | null {
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null
}
View on GitHub (pinned to 1136503c6a)
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.
Example fix
// before
await ipc.call('localhostLabel:register', { targetUrl, projectName: '', worktreeName })
// after
if (!targetUrl || !projectName || !worktreeName) throw new Error('All fields required')
await ipc.call('localhostLabel:register', { targetUrl, projectName, worktreeName }) Defensive patterns
Strategy: validation
Validate before calling
function requireString(value: unknown, field: string): string {
if (typeof value !== 'string' || value.trim().length === 0) {
throw new Error(`Invalid ${field}`)
}
return value.trim()
} Type guard
function isNonEmptyTrimmedString(value: unknown): value is string {
return typeof value === 'string' && value.trim().length > 0
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Project ID is required
- Custom view ID is required
- Localhost label target is not a valid URL.
- Invalid localhost label route.
- invalid_orca_profile_org_selection
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/1d255916153a831b.
Report an issue: GitHub.