{"record":{"id":"1d2e22e74d7f0e3e","repo":"OtterMind/Chat2DB","slug":"missing-file","errorCode":null,"errorMessage":"Missing file","messagePattern":"Missing file","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"chat2db-community-client/src/service/aiAttachment.ts","lineNumber":40,"sourceCode":"  '/api/v3/ai/chat/attachment/parse/local',\n  {\n    method: 'post',\n  },\n);\n\nasync function parseAttachment(input: { file?: File; filePath?: string; fileName?: string }) {\n  if (isDesktop) {\n    if (!input.filePath) {\n      throw new Error('Missing local file path');\n    }\n    return parseLocalAttachment({\n      filePath: input.filePath,\n      fileName: input.fileName,\n    });\n  }\n\n  if (!input.file) {\n    throw new Error('Missing file');\n  }\n\n  return parseUploadedAttachment({\n    file: input.file,\n  });\n}\n\nexport default {\n  parseAttachment,\n};\n","sourceCodeStart":22,"sourceCodeEnd":51,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/service/aiAttachment.ts#L22-L51","documentation":"parseAttachment throws 'Missing file' when running in web (non-desktop) mode but input.file is not provided. In the browser, file parsing uses an uploaded File object via parseUploadedAttachment (POST /api/v3/ai/chat/attachment/parse/upload with multipart formData). Without a File object, there is nothing to upload.","triggerScenarios":"Calling parseAttachment({ filePath: '/some/path' }) or parseAttachment({}) while isDesktop is false. The caller passed a file path instead of a File object in browser context, or the file input returned null/undefined.","commonSituations":"A file picker that returned null (user cancelled). Code path designed for desktop that passes filePath but runs in browser. File object dropped during state propagation.","solutions":["Verify the File object is present before calling parseAttachment in web mode.","Handle the file-picker cancel case and avoid calling parseAttachment when no file is selected.","Use an assertion or early-return if input.file is falsy."],"exampleFix":"// before\nawait parseAttachment({ file: selectedFile });\n\n// after\nif (!isDesktop && !selectedFile) {\n  message.warning('Please select a file first');\n  return;\n}\nawait parseAttachment({ file: selectedFile });","handlingStrategy":"validation","validationCode":"if (!isDesktop && !(input.file instanceof File)) {\n  message.warning('Please select a file to attach');\n  return;\n}","typeGuard":"function isWebFileInput(input: { file?: File }): input is { file: File } {\n  return !isDesktop && input.file instanceof File;\n}","tryCatchPattern":null,"preventionTips":["Handle file-picker cancellation (returns null) before calling parseAttachment.","Validate input.file is a File instance in web mode.","Guard with an early-return to avoid the throw."],"tags":["web","ai","file-handling","validation","frontend"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}