{"record":{"id":"6ed2c9217ba7b3e2","repo":"chroma-core/chroma","slug":"user-missing-tokens","errorCode":null,"errorMessage":"User missing tokens","messagePattern":"User missing tokens","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/auth/token_authn/__init__.py","lineNumber":172,"sourceCode":"\n        self._token_user_mapping: Dict[str, User] = {}\n        creds = self.read_creds_or_creds_file()\n\n        # If we only get one cred, assume it's just a valid token.\n        if len(creds) == 1:\n            self._token_user_mapping[creds[0]] = User(\n                id=\"anonymous\",\n                tenant=\"*\",\n                databases=[\"*\"],\n                role=\"anonymous\",\n                tokens=[creds[0]],\n            )\n            return\n\n        self._users = cast(List[User], yaml.safe_load(\"\\n\".join(creds))[\"users\"])\n        for user in self._users:\n            if \"tokens\" not in user:\n                raise ValueError(\"User missing tokens\")\n            if \"tenant\" not in user:\n                user[\"tenant\"] = \"*\"\n            if \"databases\" not in user:\n                user[\"databases\"] = [\"*\"]\n            for token in user[\"tokens\"]:\n                _check_token(token)\n                if (\n                    token in self._token_user_mapping\n                    and self._token_user_mapping[token] != user\n                ):\n                    raise ValueError(\n                        f\"Token {token} already in use: wanted to use it for \"\n                        f\"user {user['id']} but it's already in use by \"\n                        f\"user {self._token_user_mapping[token]}\"\n                    )\n                self._token_user_mapping[token] = user\n\n    @trace_method(","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/auth/token_authn/__init__.py#L154-L190","documentation":"Raised in TokenAuthenticationServerProvider.__init__ while parsing the auth credentials YAML: a user entry in the users config lacks the required 'tokens' key. It fires when the server auth file defines a user without an associated token list, making the user impossible to authenticate.","triggerScenarios":"Thrown at chromadb/auth/token_authn/__init__.py:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a 'tokens' key with a list of token strings to each user entry in the auth credentials YAML","Validate the credentials file against the expected schema (id, tenant, databases, role, tokens)","Check that the YAML structure was not flattened or corrupted (e.g., a missing indentation level)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","contentChangedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}