{"record":{"id":"7d732cddb23e92fc","repo":"sgl-project/sglang","slug":"output-format-must-be-list-or-numpy","errorCode":null,"errorMessage":"output_format must be 'list' or 'numpy'","messagePattern":"output_format must be 'list' or 'numpy'","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py","lineNumber":342,"sourceCode":"        prefix_cache = observation.get(\"enable_prefix_cache\")\n    if prefix_cache is None:\n        prefix_cache = observation.get(\"enable_pi_prefix_cache\")\n    cuda_graph = runtime.get(\"cuda_graph\")\n    if cuda_graph is None:\n        cuda_graph = observation.get(\"enable_cuda_graph\")\n    if cuda_graph is None:\n        cuda_graph = observation.get(\"enable_pi_cuda_graph\")\n    output_format = str(\n        runtime.get(\n            \"output_format\",\n            parameters.get(\n                \"output_format\",\n                observation.get(\"output_format\", \"list\"),\n            ),\n        )\n    ).lower()\n    if output_format not in (\"list\", \"numpy\"):\n        raise ValueError(\"output_format must be 'list' or 'numpy'\")\n\n    sampling_kwargs = {\n        \"request_id\": payload.get(\"request_id\") or payload.get(\"id\"),\n        \"prompt\": prompt,\n        \"images\": images,\n        \"image_masks\": observation.get(\"image_masks\"),\n        \"camera_order\": observation.get(\"camera_order\"),\n        \"state\": state,\n        \"noise\": noise,\n        \"observation\": observation,\n        \"action_horizon\": int(\n            parameters.get(\n                \"action_horizon\",\n                observation.get(\"action_horizon\", pipeline_config.action_horizon),\n            )\n        ),\n        \"action_dim\": int(\n            parameters.get(","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py#L324-L360","documentation":"The action endpoint's output_format option controls the returned action representation and only accepts 'list' or 'numpy' (case-insensitive after .lower()). Any other value is rejected before the request is submitted. The value is merged from parameters.output_format and observation.output_format, defaulting to 'list'.","triggerScenarios":"POST /v1/actions with parameters.output_format='tensor', 'json', or 'torch'.","commonSituations":"Expecting torch.Tensor passthrough; typo like 'np' or 'Numpy arrays' (spaces are not stripped, only lowercased); stale config from another API.","solutions":["Set output_format to 'list' or 'numpy'","Or omit it — the default is 'list'","Convert client-side: np.asarray(result.actions) if you need numpy from list output"],"exampleFix":"# before\n{\"parameters\": {\"output_format\": \"tensor\"}}\n# after\n{\"parameters\": {\"output_format\": \"numpy\"}}","handlingStrategy":"validation","validationCode":"fmt = str(params.get('output_format','list')).lower()\nassert fmt in ('list','numpy'), \"output_format must be 'list' or 'numpy'\"","typeGuard":"def is_valid_output_format(f) -> bool:\n    return str(f).lower() in ('list', 'numpy')","tryCatchPattern":null,"preventionTips":["Omit output_format unless you need numpy","Convert formats client-side instead of inventing server-side values"],"tags":["action-endpoint","output-format","enum-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}