OtterMind/Chat2DB · error · Error

Missing file

Error message

Missing file

What it means

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.

Source

Thrown at chat2db-community-client/src/service/aiAttachment.ts:40

  '/api/v3/ai/chat/attachment/parse/local',
  {
    method: 'post',
  },
);

async function parseAttachment(input: { file?: File; filePath?: string; fileName?: string }) {
  if (isDesktop) {
    if (!input.filePath) {
      throw new Error('Missing local file path');
    }
    return parseLocalAttachment({
      filePath: input.filePath,
      fileName: input.fileName,
    });
  }

  if (!input.file) {
    throw new Error('Missing file');
  }

  return parseUploadedAttachment({
    file: input.file,
  });
}

export default {
  parseAttachment,
};

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Verify the File object is present before calling parseAttachment in web mode.
  2. Handle the file-picker cancel case and avoid calling parseAttachment when no file is selected.
  3. Use an assertion or early-return if input.file is falsy.

Example fix

// before
await parseAttachment({ file: selectedFile });

// after
if (!isDesktop && !selectedFile) {
  message.warning('Please select a file first');
  return;
}
await parseAttachment({ file: selectedFile });
Defensive patterns

Strategy: validation

Validate before calling

if (!isDesktop && !(input.file instanceof File)) {
  message.warning('Please select a file to attach');
  return;
}

Type guard

function isWebFileInput(input: { file?: File }): input is { file: File } {
  return !isDesktop && input.file instanceof File;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/1d2e22e74d7f0e3e. Report an issue: GitHub.