{"record":{"id":"8e352ed67ada274f","repo":"stablyai/orca","slug":"invalid-fieldname","errorCode":null,"errorMessage":"Invalid ${fieldName}","messagePattern":"Invalid (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/main/ipc/linear.ts","lineNumber":69,"sourceCode":"  return workspaceId\n}\n\nfunction normalizeCustomViewModel(value: unknown): LinearCustomViewModel {\n  if (value !== 'issue' && value !== 'project') {\n    throw new Error('Custom view model is required')\n  }\n  return value\n}\n\nfunction normalizeIdList(value: unknown, fieldName: string): string[] | undefined {\n  if (value === undefined) {\n    return undefined\n  }\n  if (\n    !Array.isArray(value) ||\n    !value.every((id): id is string => typeof id === 'string' && Boolean(id.trim()))\n  ) {\n    throw new Error(`Invalid ${fieldName}`)\n  }\n  return value.map((id) => id.trim())\n}\n\nfunction normalizeOptionalDate(value: unknown, fieldName: string): string | undefined {\n  if (value === undefined || value === null || value === '') {\n    return undefined\n  }\n  if (typeof value !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value.trim())) {\n    throw new Error(`Invalid ${fieldName}`)\n  }\n  return value.trim()\n}\n\nexport function registerLinearHandlers(): void {\n  ipcMain.handle('linear:connect', async (_event, args: { apiKey: string }) => {\n    if (typeof args?.apiKey !== 'string' || !args.apiKey.trim()) {\n      return { ok: false, error: 'Invalid API key' }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/linear.ts#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the field as an array of non-empty string IDs, or omit it entirely (undefined) when empty.","Normalize single values to arrays and trim each element before the IPC call.","Filter out empty/whitespace entries before sending."],"exampleFix":"// before\nawait ipc.call('linear:listIssues', { teamIds: selectedTeamId })\n\n// after\nconst teamIds = (Array.isArray(selectedTeamId) ? selectedTeamId : [selectedTeamId]).map(s => s.trim()).filter(Boolean)\nawait ipc.call('linear:listIssues', { teamIds })","handlingStrategy":"validation","validationCode":"function normalizeIds(value: unknown): string[] | undefined {\n  if (value === undefined) return undefined\n  if (!Array.isArray(value) || !value.every(v => typeof v === 'string' && v.trim())) {\n    throw new Error('Invalid ID list')\n  }\n  return value.map(v => v.trim())\n}","typeGuard":"function isIdList(value: unknown): value is string[] {\n  return Array.isArray(value) && value.every(v => typeof v === 'string' && v.trim().length > 0)\n}","tryCatchPattern":null,"preventionTips":["Pass ID lists as arrays of non-empty strings; omit (undefined) when empty.","Normalize single selections to arrays before sending.","Filter out empty/whitespace entries at the renderer boundary."],"tags":["linear","validation","array","ipc"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}