{"record":{"id":"95b6b0c232c23690","repo":"infiniflow/ragflow","slug":"dependency-error","errorCode":"dependency_error","errorMessage":"parser_id omitted → required fields missing: {fields}","messagePattern":"parser_id omitted → required fields missing: (.+?)","errorType":"validation","errorClass":"PydanticCustomError","httpStatus":null,"severity":"error","filePath":"api/utils/validation_utils.py","lineNumber":804,"sourceCode":"        - If parser_id is provided (valid enum) → parse_type and pipeline_id must be None (disallow mixed usage)\n\n        Raises:\n            PydanticCustomError with code 'dependency_error' on violation.\n        \"\"\"\n        # Omitted chunk_method (not in fields) logic\n        if self.chunk_method is None and \"chunk_method\" not in self.model_fields_set:\n            # All three absent → default naive\n            if self.parse_type is None and self.pipeline_id is None:\n                object.__setattr__(self, \"chunk_method\", \"naive\")\n                return self\n            # parser_id omitted: require BOTH parse_type & pipeline_id present (no partial allowed)\n            if self.parse_type is None or self.pipeline_id is None:\n                missing = []\n                if self.parse_type is None:\n                    missing.append(\"parse_type\")\n                if self.pipeline_id is None:\n                    missing.append(\"pipeline_id\")\n                raise PydanticCustomError(\n                    \"dependency_error\",\n                    \"parser_id omitted → required fields missing: {fields}\",\n                    {\"fields\": \", \".join(missing)},\n                )\n            # Both provided → allow pipeline mode\n            return self\n\n        # parser_id provided (valid): parse_type MUST be one of [None, 1], and MUST NOT have pipeline_id\n        if isinstance(self.chunk_method, str):\n            invalid = []\n            if self.parse_type not in [None, 1] or self.pipeline_id is not None:\n                if self.parse_type not in [None, 1]:\n                    invalid.append(\"parse_type\")\n                if self.pipeline_id is not None:\n                    invalid.append(\"pipeline_id\")\n                raise PydanticCustomError(\n                    \"dependency_error\",\n                    \"parser_id provided → disallowed fields present: {fields}\",","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/utils/validation_utils.py#L786-L822","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Send parse_type and pipeline_id together when using ingestion pipeline mode, e.g. {\"parse_type\": 2, \"pipeline_id\": \"<32hex>\"}.","Or omit both entirely and let the server default chunk_method to 'naive'.","Do not mix: never pair parse_type/pipeline_id with an explicit chunk_method."],"exampleFix":"# before\n{\"name\": \"ds\", \"parse_type\": 2}\n\n# after\n{\"name\": \"ds\", \"parse_type\": 2, \"pipeline_id\": \"2f3c0f9c7b1d11f0a1b2c3d4e5f67890\"}","handlingStrategy":"validation","validationCode":"def validate_dataset_request(body: dict) -> None:\n    has_parser = \"chunk_method\" in body and body[\"chunk_method\"] is not None\n    has_pt = body.get(\"parse_type\") is not None\n    has_pid = body.get(\"pipeline_id\") is not None\n    if not has_parser and (has_pt != has_pid):\n        missing = [f for f, present in ((\"parse_type\", has_pt), (\"pipeline_id\", has_pid)) if not present]\n        raise ValueError(f\"pipeline mode requires both fields; missing: {missing}\")","typeGuard":"type DatasetCreate =\n  | { chunk_method?: string; parse_type?: never; pipeline_id?: never }\n  | { chunk_method?: never; parse_type: number; pipeline_id: string };","tryCatchPattern":"try:\n    api.create_dataset(body)\nexcept ValidationError as e:\n    if any(err[\"type\"] == \"dependency_error\" and \"required fields missing\" in str(err) for err in e.errors()):\n        body.setdefault(\"parse_type\", DEFAULT_PARSE_TYPE)\n        body.setdefault(\"pipeline_id\", DEFAULT_PIPELINE_ID)\n        api.create_dataset(body)","preventionTips":["Model pipeline mode as an all-or-nothing object in the client.","Set parse_type and pipeline_id in the same code branch.","Default to plain naive mode: send neither field."],"tags":["dependency-validation","pipeline","datasets","request-shape"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}