pathwaycom/pathway · error · ValueError

Unknown endpoint input format: {format}

Error message

Unknown endpoint input format: {format}

What it means

Raised while building an endpoint's OpenAPI description when the request/response input `format` is neither "raw" nor "custom". The schema builder maps "raw" to a text/plain plaintext schema and "custom" to an application/json schema; any other value cannot be described and is rejected.

Source

Thrown at python/pathway/io/http/_server.py:190

        if method.upper() == "GET":
            # Get requests receive parameters from CGI, so their schema description
            # is a bit different from the POST / PUT / PATCH
            endpoint_description = {
                "parameters": self._construct_openapi_get_request_schema(schema),
                # disable yaml optimization to avoid
                # "instance type (string) does not match any allowed primitive type"
                # error from openapi validator
                "responses": copy.deepcopy(self.DEFAULT_RESPONSES_DESCRIPTION),
            }
        else:
            if format == "raw":
                content_header = "text/plain"
                openapi_schema = self._construct_openapi_plaintext_schema(schema)
            elif format == "custom":
                content_header = "application/json"
                openapi_schema = self._construct_openapi_json_schema(schema)
            else:
                raise ValueError(f"Unknown endpoint input format: {format}")
            schema_and_examples = {"schema": openapi_schema}
            if self.examples:
                schema_and_examples["examples"] = self.examples._openapi_description()
            content_description = {content_header: schema_and_examples}
            endpoint_description = {
                "requestBody": {
                    "content": content_description,
                },
                # disable yaml optimization to avoid
                # "instance type (string) does not match any allowed primitive type"
                # error from openapi validator
                "responses": copy.deepcopy(self.DEFAULT_RESPONSES_DESCRIPTION),
            }

        if self.tags is not None:
            endpoint_description["tags"] = list(self.tags)
        if self.description is not None:
            endpoint_description["description"] = self.description

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Use format="raw" for plain-text endpoints and format="custom" for JSON-validated endpoints when constructing the endpoint schema.
  2. Validate the format before endpoint construction: assert format in ("raw", "custom").
  3. If you need JSON input, use format="custom" (it builds a JSON schema and sets application/json).

Example fix

# before
endpoint = http_endpoint(schema=MySchema, format="json")

# after
endpoint = http_endpoint(schema=MySchema, format="custom")
Defensive patterns

Strategy: validation

Validate before calling

assert format in ("raw", "custom"), 'endpoint format must be "raw" or "custom"'

Type guard

def is_valid_endpoint_format(fmt: str) -> bool:
    return fmt in ("raw", "custom")

Prevention

When it happens

Trigger: Creating an HTTP endpoint with format="json" or format="binary" (only "raw" and "custom" are accepted here); forwarding an unvalidated format string from a wrapper that builds EndpointSchema descriptions.

Common situations: Confusing this internal schema-format parameter with the connector-level payload format names ("json"/"custom") used elsewhere in pathway's HTTP stack; wrappers or generated code passing through arbitrary user strings.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/d0554da41db5f4fd. Report an issue: GitHub.