stablyai/orca · error · Error

Invalid ${fieldName}

Error message

Invalid ${fieldName}

What it means

Thrown by normalizeIdList when a field expected to be an array of non-empty trimmed string IDs is not an array, or any element is not a non-empty string. The fieldName is interpolated so the message names the offending field (e.g. 'Invalid teamIds', 'Invalid projectIds'). This guards list/filter Linear IPC arguments that accept optional ID arrays.

Source

Thrown at src/main/ipc/linear.ts:69

  return workspaceId
}

function normalizeCustomViewModel(value: unknown): LinearCustomViewModel {
  if (value !== 'issue' && value !== 'project') {
    throw new Error('Custom view model is required')
  }
  return value
}

function normalizeIdList(value: unknown, fieldName: string): string[] | undefined {
  if (value === undefined) {
    return undefined
  }
  if (
    !Array.isArray(value) ||
    !value.every((id): id is string => typeof id === 'string' && Boolean(id.trim()))
  ) {
    throw new Error(`Invalid ${fieldName}`)
  }
  return value.map((id) => id.trim())
}

function normalizeOptionalDate(value: unknown, fieldName: string): string | undefined {
  if (value === undefined || value === null || value === '') {
    return undefined
  }
  if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value.trim())) {
    throw new Error(`Invalid ${fieldName}`)
  }
  return value.trim()
}

export function registerLinearHandlers(): void {
  ipcMain.handle('linear:connect', async (_event, args: { apiKey: string }) => {
    if (typeof args?.apiKey !== 'string' || !args.apiKey.trim()) {
      return { ok: false, error: 'Invalid API key' }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pass the field as an array of non-empty string IDs, or omit it entirely (undefined) when empty.
  2. Normalize single values to arrays and trim each element before the IPC call.
  3. Filter out empty/whitespace entries before sending.

Example fix

// before
await ipc.call('linear:listIssues', { teamIds: selectedTeamId })

// after
const teamIds = (Array.isArray(selectedTeamId) ? selectedTeamId : [selectedTeamId]).map(s => s.trim()).filter(Boolean)
await ipc.call('linear:listIssues', { teamIds })
Defensive patterns

Strategy: validation

Validate before calling

function normalizeIds(value: unknown): string[] | undefined {
  if (value === undefined) return undefined
  if (!Array.isArray(value) || !value.every(v => typeof v === 'string' && v.trim())) {
    throw new Error('Invalid ID list')
  }
  return value.map(v => v.trim())
}

Type guard

function isIdList(value: unknown): value is string[] {
  return Array.isArray(value) && value.every(v => typeof v === 'string' && v.trim().length > 0)
}

Prevention

When it happens

Trigger: Passing an ID-list field (teamIds, projectIds, assigneeIds, etc.) that is a single string instead of an array, an array containing empty strings or non-string values, or null/object instead of undefined when omitted.

Common situations: Renderer serializes a single selection as a string rather than [string]. Stale state holds null instead of undefined. A deserialized payload from storage contains numeric IDs. Whitespace-only strings slip through from trimmed form fields.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/8e352ed67ada274f. Report an issue: GitHub.