{"record":{"id":"5e85203f3494f404","repo":"odysseus-dev/odysseus","slug":"err-detail-import-failed","errorCode":null,"errorMessage":"err.detail || 'Import failed'","messagePattern":"err\\.detail \\|\\| 'Import failed'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"static/js/memory.js","lineNumber":1321,"sourceCode":"    importBtn.appendChild(importSpin.element);\n    importBtn.appendChild(document.createTextNode('Importing'));\n  }\n\n  try {\n    const formData = new FormData();\n    formData.append('file', file);\n    if (sessionId) {\n        formData.append('session', sessionId);\n    }\n\n    const res = await fetch(`${window.location.origin}/api/memory/import`, {\n      method: 'POST',\n      body: formData\n    });\n\n    if (!res.ok) {\n      const err = await res.json().catch(() => ({}));\n      throw new Error(err.detail || 'Import failed');\n    }\n\n    const data = await res.json();\n    const suggestions = data.suggestions || [];\n\n    // Show suggestions using the existing suggestions UI\n    const modal = document.getElementById('memory-modal');\n    const body = document.getElementById('memory-suggestions-body');\n    if (!body) return;\n\n    body.innerHTML = '';\n    body.classList.remove('hidden');\n\n    const memList = document.getElementById('memory-list');\n    if (memList) memList.classList.add('hidden');\n\n    if (suggestions.length === 0) {\n      body.innerHTML = '<div class=\"memory-empty\">No useful information found in file.</div>';","sourceCodeStart":1303,"sourceCodeEnd":1339,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/static/js/memory.js#L1303-L1339","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the response detail — it names the parse/validation failure.","Confirm the file type is one the import endpoint accepts and the file is non-empty.","For parser errors, convert/re-export the document (e.g. text-based PDF vs scanned) and retry.","Verify the memory/embedding backend is initialized in server logs if detail is generic."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!file || file.size === 0) { toast('Select a non-empty file'); return; }\nif (file.size > MAX_IMPORT_BYTES) { toast('File too large'); return; }","typeGuard":"const isImportResult = (d) => d && typeof d === 'object' && Array.isArray(d.suggestions || []);","tryCatchPattern":"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}`); }","preventionTips":["Pre-check file presence and size before building FormData","Parse detail from JSON rather than assuming success","Surface parser details so users learn which file failed"],"tags":["memory","import","upload","http"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}