{"record":{"id":"e69695c20dda691d","repo":"nexu-io/open-design","slug":"sourcekind-must-be-one-of-upload-url-repo-conne","errorCode":null,"errorMessage":"sourceKind must be one of upload, url, repo, connector, artifact, chat","messagePattern":"sourceKind must be one of upload, url, repo, connector, artifact, chat","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/daemon/src/automation-ingestions.ts","lineNumber":107,"sourceCode":"): Promise<AutomationContentPacket | null> {\n  const packets = await listAutomationSourcePackets(dataDir);\n  return packets.find((packet) => packet.id === id) ?? null;\n}\n\nfunction asString(value: unknown): string {\n  return typeof value === 'string' ? value.trim() : '';\n}\n\nfunction optionalString(value: unknown): string | undefined {\n  const text = asString(value);\n  return text ? text : undefined;\n}\n\nfunction sourceKindFrom(value: unknown): AutomationSourceKind {\n  if (typeof value === 'string' && SOURCE_KINDS.has(value as AutomationSourceKind)) {\n    return value as AutomationSourceKind;\n  }\n  throw new Error('sourceKind must be one of upload, url, repo, connector, artifact, chat');\n}\n\nfunction sensitivityFrom(value: unknown): AutomationSensitivity {\n  if (typeof value === 'string' && SENSITIVITY_VALUES.has(value as AutomationSensitivity)) {\n    return value as AutomationSensitivity;\n  }\n  return 'workspace';\n}\n\nfunction compressionModeFrom(\n  value: unknown,\n  fallback: AutomationTokenCompressionMode,\n): AutomationTokenCompressionMode {\n  if (typeof value === 'string' && COMPRESSION_MODES.has(value as AutomationTokenCompressionMode)) {\n    return value as AutomationTokenCompressionMode;\n  }\n  return fallback;\n}","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/automation-ingestions.ts#L89-L125","documentation":"Thrown by sourceKindFrom() in ingestAutomationSource when input.sourceKind is not one of upload, url, repo, connector, artifact, chat. Unlike sensitivity/compression/reviewPolicy (which fall back silently), sourceKind is required and has no default, so an unknown value is a hard error.","triggerScenarios":"POST to the ingestion endpoint with sourceKind missing, misspelled (e.g. 'uploaded', 'repository', 'Github'), or using a wrong-case variant ('Upload'). The check is case-sensitive against the literal set.","commonSituations":"Client SDK typo; integration sending a connector-specific verb instead of the canonical 'connector'; case mismatch; an older client using a value that was renamed.","solutions":["Set sourceKind to exactly one of: upload, url, repo, connector, artifact, chat (lowercase).","If unsure, pick 'upload' for user-attached files, 'url' for fetched links, 'connector' for integration-sourced content.","Update the client SDK/contract type to surface the allowed values at compile time."],"exampleFix":"// before\nfetch(url, { method: 'POST', body: JSON.stringify({ sourceKind: 'uploaded', bodyMarkdown: '...' }) })\n// after\nfetch(url, { method: 'POST', body: JSON.stringify({ sourceKind: 'upload', bodyMarkdown: '...' }) })","handlingStrategy":"type-guard","validationCode":"const ALLOWED_SOURCE_KINDS = new Set(['upload','url','repo','connector','artifact','chat']);\nif (!ALLOWED_SOURCE_KINDS.has(input.sourceKind)) {\n  throw new Error(`sourceKind must be one of ${[...ALLOWED_SOURCE_KINDS].join(', ')}`);\n}","typeGuard":"const SOURCE_KINDS = new Set(['upload','url','repo','connector','artifact','chat']);\nfunction isAutomationSourceKind(v: unknown): v is 'upload'|'url'|'repo'|'connector'|'artifact'|'chat' {\n  return typeof v === 'string' && SOURCE_KINDS.has(v as any);\n}","tryCatchPattern":null,"preventionTips":["Use the AutomationSourceKind contract type from @open-design/contracts so the compiler catches typos.","Send lowercase canonical values; the check is case-sensitive.","Validate sourceKind on the client before posting."],"tags":["automation","ingestion","validation","api","daemon"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}