{"record":{"id":"9635fb88296d1a2c","repo":"langchain-ai/langgraph","slug":"text-fields-must-be-a-list-or-a-string-got-field","errorCode":null,"errorMessage":"Text fields must be a list or a string. Got {fields}","messagePattern":"Text fields must be a list or a string\\. Got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/checkpoint-postgres/langgraph/store/postgres/base.py","lineNumber":1463,"sourceCode":"    elif distance_type == \"inner_product\":\n        # Final: \"-(sv.embedding <#> %s::%s)\"\n        return \"sv.embedding <#> %s::%s\", \"-(scored.neg_score)\"\n    else:  # cosine similarity\n        # Final:  \"1 - (sv.embedding <=> %s::%s)\"\n        return \"sv.embedding <=> %s::%s\", \"1 - scored.neg_score\"\n\n\ndef _ensure_index_config(\n    index_config: PostgresIndexConfig,\n) -> tuple[Embeddings | None, PostgresIndexConfig]:\n    index_config = index_config.copy()\n    tokenized: list[tuple[str, Literal[\"$\"] | list[str]]] = []\n    tot = 0\n    fields = index_config.get(\"fields\") or [\"$\"]\n    if isinstance(fields, str):\n        fields = [fields]\n    if not isinstance(fields, list):\n        raise ValueError(f\"Text fields must be a list or a string. Got {fields}\")\n    for p in fields:\n        if p == \"$\":\n            tokenized.append((p, \"$\"))\n            tot += 1\n        else:\n            toks = tokenize_path(p)\n            tokenized.append((p, toks))\n            tot += len(toks)\n    index_config[\"__tokenized_fields\"] = tokenized\n    index_config[\"__estimated_num_vectors\"] = tot\n    embeddings = ensure_embeddings(\n        index_config.get(\"embed\"),\n    )\n    return embeddings, index_config\n\n\nPLACEHOLDER = object()\n","sourceCodeStart":1445,"sourceCodeEnd":1481,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/checkpoint-postgres/langgraph/store/postgres/base.py#L1445-L1481","documentation":"Error \"Text fields must be a list or a string. Got {fields}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/checkpoint-postgres/langgraph/store/postgres/base.py:1463 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}