BerriAI/litellm · error · ValueError
Unified id does not contain {marker!r}: {file_id[:80]!r}
Error message
Unified id does not contain {marker!r}: {file_id[:80]!r} What it means
get_output_file_id_from_unified_file_id parses the internal unified file id format, which embeds segments like 'llm_output_file_id,<id>;'. If that marker is absent — corrupt, truncated, or a foreign/unmanaged id that happened to decode — a ValueError is raised showing the first 80 chars for diagnosis. The id was already accepted as base64 unified id, so this signals format corruption rather than a wrong id type.
Source
Thrown at enterprise/litellm_enterprise/proxy/hooks/managed_files.py:1139
def get_unified_output_file_id(self, output_file_id: str, model_id: str, model_name: Optional[str]) -> str:
deterministic_uuid: Final = uuid5(uuid5(NAMESPACE_URL, model_id), output_file_id)
unified_output_file_id = SpecialEnums.LITELLM_MANAGED_FILE_COMPLETE_STR.value.format(
"application/json",
str(deterministic_uuid),
model_name or "",
output_file_id,
model_id,
)
return base64.urlsafe_b64encode(unified_output_file_id.encode()).decode().rstrip("=")
def get_model_id_from_unified_file_id(self, file_id: str) -> str:
return file_id.split("llm_output_file_model_id,")[1].split(";")[0]
def get_output_file_id_from_unified_file_id(self, file_id: str) -> str:
marker = "llm_output_file_id,"
if marker not in file_id:
raise ValueError(f"Unified id does not contain {marker!r}: {file_id[:80]!r}")
return file_id.split(marker, 1)[1].split(";")[0]
async def async_post_call_success_hook(
self, data: Dict, user_api_key_dict: UserAPIKeyAuth, response: LLMResponseTypes
) -> LLMResponseTypes:
if isinstance(response, LiteLLMBatch):
## Check if unified_file_id is in the response
unified_file_id = response._hidden_params.get("unified_file_id") # managed file id
unified_batch_id = response._hidden_params.get("unified_batch_id") # managed batch id
model_id = cast(Optional[str], response._hidden_params.get("model_id"))
model_name = cast(Optional[str], response._hidden_params.get("model_name"))
resolved_model_name = resolve_managed_output_file_model_name(
unified_input_file_id=unified_file_id if isinstance(unified_file_id, str) else response.input_file_id,
fallback_model_name=model_name,
)
original_response_id = response.id
View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use the output file id exactly as returned in the batch completion payload, not reconstructed or stored copies
- Verify stored id columns/properties can hold the full base64 string without truncation
- Confirm you are passing an output-file unified id (contains llm_output_file_id) and not a batch or input-file id
- Recreate the batch if its ids predate the current unified-id format
Example fix
# before file_id = batch_response.id # batch id, wrong parser path # after file_id = batch_response.output_file_id # correct output-file unified id
Defensive patterns
Strategy: type-guard
Validate before calling
OUTPUT_MARKER = "llm_output_file_id,"
def is_output_file_unified_id(fid: str) -> bool:
import base64
try:
raw = base64.urlsafe_b64decode(fid + "=" * (-len(fid) % 4)).decode()
return OUTPUT_MARKER in raw
except Exception:
return False
assert is_output_file_unified_id(fid), "not an output-file unified id" Type guard
def is_output_file_unified_id(file_id: str) -> bool:
import base64
try:
raw = base64.urlsafe_b64decode(file_id + "=" * (-len(file_id) % 4)).decode()
return "llm_output_file_id," in raw
except Exception:
return False Try / catch
try:
get_output_file_id_from_unified_file_id(fid)
except ValueError as e:
# id lacks the output-file segment; refetch the correct id from the batch object
raise TypeError(f"{fid} is not an output-file unified id") from e Prevention
- Use batch.output_file_id (which embeds the marker) rather than batch.id
- Never store ids in truncated columns or trim base64 padding
- Unit-test id round-trips through your persistence layer
When it happens
Trigger: A base64 string that decodes but lacks the output-file segment (batch output file ids from an older format or hand-assembled); ids truncated by storage columns or URL handling; decoding a unified batch id with the file-id parser.
Common situations: Schema migrations that shortened id columns; middleware trimming long ids; mixing id types (batch id vs output file id) in client code after API changes.
Related errors
- LiteLLM Managed {accessor_key} with id={retrieve_object_id}
- LiteLLM Managed File object with id={file_id} has no file_ob
- LiteLLM Managed File object with id={file_id} not found. Che
- file_id is required in file_content_request
- contents of file are None
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/653f662f28726122.
Report an issue: GitHub.