{"record":{"id":"3b68f50aeff024fc","repo":"OtterMind/Chat2DB","slug":"missing-local-file-path","errorCode":null,"errorMessage":"Missing local file path","messagePattern":"Missing local file path","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"chat2db-community-client/src/service/aiAttachment.ts","lineNumber":31,"sourceCode":"const parseUploadedAttachment = createRequest<{ file: File }, IChatAttachment>(\n  '/api/v3/ai/chat/attachment/parse/upload',\n  {\n    method: 'post',\n    contentType: 'formData',\n  },\n);\n\nconst parseLocalAttachment = createRequest<{ filePath: string; fileName?: string }, IChatAttachment>(\n  '/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,","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-client/src/service/aiAttachment.ts#L13-L49","documentation":"parseAttachment throws 'Missing local file path' when running in desktop mode (isDesktop === true) but input.filePath is not provided. In the desktop (JCEF) runtime, file parsing uses a local file path via parseLocalAttachment (POST /api/v3/ai/chat/attachment/parse/local) rather than an uploaded File object. The file path is the only way for the desktop backend to locate and read the file.","triggerScenarios":"Calling parseAttachment({ file: someFile }) or parseAttachment({}) while isDesktop is true. This occurs when desktop code passes a File object (web-style) instead of a file path, or when the JCEF file dialog fails to return a path.","commonSituations":"Desktop build where the JCEF file picker returns a File but not its native path. Migrating web attachment code to desktop without converting File to filePath. A bug in the JCEF bridge where the native path is not exposed.","solutions":["In desktop mode, pass the native file path (from JCEF file dialog) as input.filePath instead of a File object.","Ensure the JCEF file dialog handler returns and forwards the absolute file path.","Add a guard before calling parseAttachment to verify isDesktop implies filePath is present."],"exampleFix":"// before\nawait parseAttachment({ file });\n\n// after\nawait parseAttachment({\n  filePath: isDesktop ? file.path : undefined,\n  file: isDesktop ? undefined : file,\n  fileName: file.name,\n});","handlingStrategy":"validation","validationCode":"function isDesktopAttachmentInput(input: { filePath?: string; file?: File }): input is { filePath: string } {\n  return isDesktop && typeof input.filePath === 'string' && input.filePath.length > 0;\n}\n\nif (isDesktop && !input.filePath) {\n  throw new Error('Desktop mode requires a file path from the JCEF file dialog');\n}","typeGuard":"function hasFilePath(input: unknown): input is { filePath: string } {\n  return !!input && typeof input === 'object' && typeof (input as any).filePath === 'string';\n}","tryCatchPattern":null,"preventionTips":["In desktop mode, always obtain and pass the native file path from the JCEF dialog.","Ensure the JCEF file picker returns the absolute path, not just a File object.","Validate filePath presence before calling parseAttachment."],"tags":["desktop","jcef","ai","file-handling","frontend"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}