Skip to content

index: POST /api/index returns 200 OK when all embeddings fail #354

@memtomem

Description

@memtomem

Summary

POST /api/index returns 200 OK even when every file in the batch fails to embed. Errors are logged to stderr only; the Web UI and CLI both treat the response as success.

Reproduce

With a base install (no [onnx] extra) and embedding.provider=onnx:

POST /api/index HTTP/1.1 200 OK
ERROR Embedding failed for .../MEMORY.md (14 chunks): fastembed is required
      for the ONNX embedding provider. Install it with: pip install memtomem[onnx]
ERROR Embedding failed for .../feedback_ai_attribution_opt_in.md (1 chunks): ...
... (hundreds of errors across every indexed file)

Web UI's stats counter shows 0 chunks but the index button gave no visible failure signal.

Source

packages/memtomem/src/memtomem/engine.py:520 (approx) logs the error and continues. The /api/index route returns its summary without aggregating per-file embedding failures.

Expected

Response body should include a counter for embedding failures (e.g. {indexed: N, embedding_failed: M, errors: [...first few paths]}) so both the Web UI and CLI can surface a loud "indexed but embeddings failed — install memtomem[onnx]" state instead of a clean-looking 200 OK.

Related

#353 fixes the upstream wizard gap that leads users here. This issue covers the downstream error-reporting gap that would remain even if the wizard surfaced everything perfectly (e.g. user who deletes fastembed after setup).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions