{"record":{"id":"603adba532e4f309","repo":"mem0ai/mem0","slug":"invalid-name-cannot-contain-whitespace-provide","errorCode":null,"errorMessage":"Invalid {name}: cannot contain whitespace. Provide a valid identifier without spaces.","messagePattern":"Invalid (.+?): cannot contain whitespace\\. Provide a valid identifier without spaces\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/memory/main.py","lineNumber":206,"sourceCode":"        The trimmed entity ID, or None if input is None\n\n    Raises:\n        ValueError: If entity ID is invalid\n    \"\"\"\n    if value is None:\n        return None\n    # Callers commonly pass integer ids (e.g. a database primary key). Coerce\n    # to str at this single validation point so scoping stays consistent across\n    # add/search/get_all/delete_all instead of crashing on `.strip()`.\n    if not isinstance(value, str):\n        value = str(value)\n    trimmed = value.strip()\n    if trimmed == \"\":\n        raise ValueError(\n            f\"Invalid {name}: cannot be empty or whitespace-only. Provide a valid identifier.\"\n        )\n    if any(c.isspace() for c in trimmed):\n        raise ValueError(\n            f\"Invalid {name}: cannot contain whitespace. Provide a valid identifier without spaces.\"\n        )\n    return trimmed\n\n\ndef _validate_search_params(threshold: Optional[float] = None, top_k: Optional[int] = None) -> None:\n    \"\"\"\n    Validates search parameters.\n\n    Args:\n        threshold: Similarity threshold (must be between 0 and 1)\n        top_k: Number of results to return (must be non-negative integer)\n\n    Raises:\n        ValueError: If threshold or top_k are invalid\n    \"\"\"\n    if threshold is not None:\n        if not isinstance(threshold, (int, float)):","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/memory/main.py#L188-L224","documentation":"Error \"Invalid {name}: cannot contain whitespace. Provide a valid identifier without spaces.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/memory/main.py:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an identifier without spaces (letters, digits, underscores/hyphens)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}