Mintplex-Labs/anything-llm · error

The 'textContent' key cannot have an empty value.

Error message

The 'textContent' key cannot have an empty value.

What it means

Validation guard in the raw-text embed API: the textContent field is missing, empty, or a zero-length value, so there is no content to embed and the request is rejected with 4xx before hitting the collector.

Source

Thrown at server/endpoints/api/document/index.js:554

          !requiredMetadata.every(
            (reqKey) =>
              Object.keys(metadata).includes(reqKey) && !!metadata[reqKey]
          )
        ) {
          return response
            .status(422)
            .json({
              success: false,
              error: `You are missing required metadata key:value pairs in your request. Required metadata key:values are ${requiredMetadata
                .map((v) => `'${v}'`)
                .join(", ")}`,
            })
            .end();
        }

        if (!textContent || textContent?.length === 0) {
          return response
            .status(422)
            .json({
              success: false,
              error: `The 'textContent' key cannot have an empty value.`,
            })
            .end();
        }

        const { success, reason, documents } = await Collector.processRawText(
          textContent,
          metadata
        );
        if (!success) {
          return response
            .status(500)
            .json({ success: false, error: reason, documents })
            .end();
        }

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Provide a non-empty string in the 'textContent' field of the request.
  2. Verify the payload was serialized correctly and not stripped before sending.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/endpoints/api/document/index.js:554 when the library encounters an invalid state.

Common situations: Posting raw text to the document API with an empty or missing textContent value.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/76a8817f3556ef65. Report an issue: GitHub.