{"record":{"id":"74dfbd730e216d89","repo":"mem0ai/mem0","slug":"invalid-name-cannot-be-empty-or-whitespace-only","errorCode":null,"errorMessage":"Invalid {name}: cannot be empty or whitespace-only. Provide a valid identifier.","messagePattern":"Invalid (.+?): cannot be empty or whitespace-only\\. Provide a valid identifier\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/memory/main.py","lineNumber":202,"sourceCode":"        value: The entity ID value to validate\n        name: The parameter name (for error messages)\n\n    Returns:\n        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:","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/memory/main.py#L184-L220","documentation":"Error \"Invalid {name}: cannot be empty or whitespace-only. Provide a valid identifier.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/memory/main.py:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty, non-whitespace identifier for the given parameter."],"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"}