infiniflow/ragflow · error · PydanticCustomError

dependency_error

dependency_error

Error message

parser_id omitted → required fields missing: {fields}

What it means

Model-level dependency validator on CreateDatasetReq. When chunk_method (parser_id) is not set, the request must either omit BOTH parse_type and pipeline_id (defaults to chunk_method='naive') or provide BOTH (ingestion-pipeline mode). Supplying only one of them raises dependency_error listing exactly which required field is missing.

Source

Thrown at api/utils/validation_utils.py:804

        - If parser_id is provided (valid enum) → parse_type and pipeline_id must be None (disallow mixed usage)

        Raises:
            PydanticCustomError with code 'dependency_error' on violation.
        """
        # Omitted chunk_method (not in fields) logic
        if self.chunk_method is None and "chunk_method" not in self.model_fields_set:
            # All three absent → default naive
            if self.parse_type is None and self.pipeline_id is None:
                object.__setattr__(self, "chunk_method", "naive")
                return self
            # parser_id omitted: require BOTH parse_type & pipeline_id present (no partial allowed)
            if self.parse_type is None or self.pipeline_id is None:
                missing = []
                if self.parse_type is None:
                    missing.append("parse_type")
                if self.pipeline_id is None:
                    missing.append("pipeline_id")
                raise PydanticCustomError(
                    "dependency_error",
                    "parser_id omitted → required fields missing: {fields}",
                    {"fields": ", ".join(missing)},
                )
            # Both provided → allow pipeline mode
            return self

        # parser_id provided (valid): parse_type MUST be one of [None, 1], and MUST NOT have pipeline_id
        if isinstance(self.chunk_method, str):
            invalid = []
            if self.parse_type not in [None, 1] or self.pipeline_id is not None:
                if self.parse_type not in [None, 1]:
                    invalid.append("parse_type")
                if self.pipeline_id is not None:
                    invalid.append("pipeline_id")
                raise PydanticCustomError(
                    "dependency_error",
                    "parser_id provided → disallowed fields present: {fields}",

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Send parse_type and pipeline_id together when using ingestion pipeline mode, e.g. {"parse_type": 2, "pipeline_id": "<32hex>"}.
  2. Or omit both entirely and let the server default chunk_method to 'naive'.
  3. Do not mix: never pair parse_type/pipeline_id with an explicit chunk_method.

Example fix

# before
{"name": "ds", "parse_type": 2}

# after
{"name": "ds", "parse_type": 2, "pipeline_id": "2f3c0f9c7b1d11f0a1b2c3d4e5f67890"}
Defensive patterns

Strategy: validation

Validate before calling

def validate_dataset_request(body: dict) -> None:
    has_parser = "chunk_method" in body and body["chunk_method"] is not None
    has_pt = body.get("parse_type") is not None
    has_pid = body.get("pipeline_id") is not None
    if not has_parser and (has_pt != has_pid):
        missing = [f for f, present in (("parse_type", has_pt), ("pipeline_id", has_pid)) if not present]
        raise ValueError(f"pipeline mode requires both fields; missing: {missing}")

Type guard

type DatasetCreate =
  | { chunk_method?: string; parse_type?: never; pipeline_id?: never }
  | { chunk_method?: never; parse_type: number; pipeline_id: string };

Try / catch

try:
    api.create_dataset(body)
except ValidationError as e:
    if any(err["type"] == "dependency_error" and "required fields missing" in str(err) for err in e.errors()):
        body.setdefault("parse_type", DEFAULT_PARSE_TYPE)
        body.setdefault("pipeline_id", DEFAULT_PIPELINE_ID)
        api.create_dataset(body)

Prevention

When it happens

Trigger: POST /api/v1/datasets with {"parse_type": 2} but no pipeline_id; or {"pipeline_id": "2f3c..."} but no parse_type; i.e. any partial pipeline-mode request.

Common situations: Incrementally building a request object and forgetting the second half of the pair; UI toggles that enable pipeline mode but only send the id; migration code that conditionally sets one field behind an if.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/95b6b0c232c23690. Report an issue: GitHub.