odysseus-dev/odysseus · error · Error

err.detail || 'Import failed'

Error message

err.detail || 'Import failed'

What it means

Thrown by memory.js when POST /api/memory/import returns non-ok; the client parses the JSON body for FastAPI-style detail and falls back to 'Import failed'. It fires during file import into the memory store, optionally tagged with a session id.

Source

Thrown at static/js/memory.js:1321

    importBtn.appendChild(importSpin.element);
    importBtn.appendChild(document.createTextNode('Importing'));
  }

  try {
    const formData = new FormData();
    formData.append('file', file);
    if (sessionId) {
        formData.append('session', sessionId);
    }

    const res = await fetch(`${window.location.origin}/api/memory/import`, {
      method: 'POST',
      body: formData
    });

    if (!res.ok) {
      const err = await res.json().catch(() => ({}));
      throw new Error(err.detail || 'Import failed');
    }

    const data = await res.json();
    const suggestions = data.suggestions || [];

    // Show suggestions using the existing suggestions UI
    const modal = document.getElementById('memory-modal');
    const body = document.getElementById('memory-suggestions-body');
    if (!body) return;

    body.innerHTML = '';
    body.classList.remove('hidden');

    const memList = document.getElementById('memory-list');
    if (memList) memList.classList.add('hidden');

    if (suggestions.length === 0) {
      body.innerHTML = '<div class="memory-empty">No useful information found in file.</div>';

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Check the response detail — it names the parse/validation failure.
  2. Confirm the file type is one the import endpoint accepts and the file is non-empty.
  3. For parser errors, convert/re-export the document (e.g. text-based PDF vs scanned) and retry.
  4. Verify the memory/embedding backend is initialized in server logs if detail is generic.
Defensive patterns

Strategy: try-catch

Validate before calling

if (!file || file.size === 0) { toast('Select a non-empty file'); return; }
if (file.size > MAX_IMPORT_BYTES) { toast('File too large'); return; }

Type guard

const isImportResult = (d) => d && typeof d === 'object' && Array.isArray(d.suggestions || []);

Try / catch

try { if (!res.ok) { const err = await res.json().catch(() => ({})); throw new Error(err.detail || 'Import failed'); } } catch (e) { showError(`Memory import failed: ${e.message}`); }

Prevention

When it happens

Trigger: Uploading an unsupported or corrupt file to /api/memory/import; file exceeding the server's size limit; multipart form missing the file field; server-side embedding/parser failure while ingesting the document.

Common situations: Importing a PDF the parser cannot read, an empty file, or a JSONL export from a different tool whose schema does not match; backend embedding model not initialized so ingestion 500s.

Related errors


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/5e85203f3494f404. Report an issue: GitHub.