{"record":{"id":"3860aadd961dc889","repo":"pathwaycom/pathway","slug":"unknown-payload-format-req-format","errorCode":null,"errorMessage":"Unknown payload format: {req_format}","messagePattern":"Unknown payload format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/http/_common.py","lineNumber":146,"sourceCode":"        message = message.replace(wildcard_to_replace, str(v))\n    return message\n\n\ndef prepare_request_payload(\n    row: dict[str, Any],\n    time: int,\n    is_addition: bool,\n    req_format: str,\n    text: str | None,\n):\n    if req_format == \"json\":\n        row[\"time\"] = time\n        row[\"diff\"] = 1 if is_addition else -1\n        return json.dumps(row)\n    elif req_format == \"custom\":\n        return unescape(text or \"\", row, time, is_addition)\n    else:\n        raise ValueError(f\"Unknown payload format: {req_format}\")\n","sourceCodeStart":128,"sourceCodeEnd":147,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/http/_common.py#L128-L147","documentation":"Raised by the internal HTTP connector payload formatter (_format_output_payload) when req_format is neither \"json\" nor \"custom\". It only knows how to serialize a row as JSON (adding time/diff metadata) or to call a user-supplied custom formatter; any other format string is a programming/internal error.","triggerScenarios":"An HTTP output endpoint configured with format=\"xml\" or \"text\" reaching the payload serialization step; internal API wrappers passing an unchecked format string through to _format_output_payload.","commonSituations":"Third-party code or forks calling pathway's internal _common helpers with new format names; stale format constants after a pathway upgrade renamed formats; a custom REST connector wrapper that forwards a user-supplied format without validation.","solutions":["Use format=\"json\" for JSON payloads or format=\"custom\" with a custom_payload_function when using the public pw.io.http REST connector.","If you call the internal helper directly, validate req_format in {\"json\", \"custom\"} before invoking it and map unsupported names to a user-facing error.","Update forked/copied connector code to the current pathway version's format names."],"exampleFix":"# before\n_format_output_payload(row, t, diff, \"xml\", None)\n\n# after\nif fmt not in (\"json\", \"custom\"):\n    raise ValueError(f\"unsupported format {fmt!r} for HTTP output\")\n_format_output_payload(row, t, diff, fmt, None)","handlingStrategy":"type-guard","validationCode":"if req_format not in (\"json\", \"custom\"):\n    raise ValueError(f\"unsupported payload format {req_format!r}; use 'json' or 'custom'\")","typeGuard":"def is_known_payload_format(fmt: str) -> bool:\n    return fmt in (\"json\", \"custom\")","tryCatchPattern":null,"preventionTips":["Do not call pathway's internal _common helpers directly; use the public HTTP connector API.","Validate format strings at your API boundary with a closed set of allowed values."],"tags":["http","format","internal-api","connector"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}