{"record":{"id":"389a71baabd35ee0","repo":"iflytek/astron-agent","slug":"eng-protocol-validate-error-filetype-field-is-incorrect","errorCode":"ENG_PROTOCOL_VALIDATE_ERROR","errorMessage":"Error: fileType field is incorrect","messagePattern":"Error: fileType field is incorrect","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/entities/file.py","lineNumber":88,"sourceCode":"                    node_outputs = node.get(\"data\").get(\"outputs\")\n                    for output in node_outputs:\n                        file_flag = output.get(\"fileType\")\n                        if file_flag is None:\n                            continue\n                        await span.add_info_event_async(f\"fileType: {file_flag}\")\n                        if file_flag == \"file\":\n                            has_file = True\n                            var_name = output.get(\"name\")\n                            var_type = output.get(\"schema\", {}).get(\"type\", \"\")\n                            allowed_file_type = output.get(\"allowedFileType\")[0]\n                            is_required = output.get(\"required\", False)\n                            file_infos.append(\n                                FileVarInfo(\n                                    var_name, var_type, allowed_file_type, is_required\n                                )\n                            )\n                        else:\n                            raise CustomException(\n                                err_code=CodeEnum.ENG_PROTOCOL_VALIDATE_ERROR,\n                                err_msg=\"Error: fileType field is incorrect\",\n                            )\n        except CustomException as err:\n            raise err\n        except Exception as e:\n            span.add_error_event(\n                \"Failed to get file variable information from protocol\"\n            )\n            span.record_exception(e)\n            raise e\n\n        return file_infos, has_file\n\n    def get_file_url(self, file_id: str) -> str:\n        \"\"\"\n        Get file information from OSS based on file_id and return the file access URL.\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/entities/file.py#L70-L106","documentation":"File.has_file_in_dsl scans DSL input variables for file-type variables and raises ENG_PROTOCOL_VALIDATE_ERROR when a variable's fileType field does not match the expected structure for building FileVarInfo. The library throws this because it cannot derive allowed file types / requiredness from a malformed or unexpected fileType declaration, and a wrong file variable schema would silently break file checks downstream.","triggerScenarios":"A DSL input variable of file type whose fileType field is not a recognized value/structure (missing allowed file type list, wrong casing, or a non-file type flowing through the file branch) while extracting FileVarInfo from the DSL.","commonSituations":"Hand-written DSL input schemas; older exports using a fileType format the current engine no longer accepts; template workflows edited manually; frontend producing an empty fileType for file inputs.","solutions":["Correct the variable's fileType field to a supported file-type declaration (e.g. proper allowed_file_type list) in the DSL","Re-save the workflow input schema via the console editor so fileType is generated in the current format","Check the engine version's expected FileVarInfo schema and migrate old DSLs accordingly","Wrap DSL loading to validate file variable schemas before constructing the engine"],"exampleFix":"# before\n\"fileType\": \"document\"  # unsupported value\n# after\n\"fileType\": {\"allowedFileTypes\": [\"pdf\", \"docx\"], \"required\": true}","handlingStrategy":"validation","validationCode":"def validate_file_vars(dsl):\n    for v in dsl.get(\"inputs\", []):\n        if v.get(\"type\") == \"file\" and not is_valid_file_type_decl(v.get(\"fileType\")):\n            raise ValueError(f\"bad fileType on {v['name']}\")","typeGuard":"def is_valid_file_type_decl(ft):\n    return isinstance(ft, dict) and bool(ft.get(\"allowedFileTypes\"))","tryCatchPattern":"try:\n    vars_ = File.has_file_in_dsl(dsl)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.ENG_PROTOCOL_VALIDATE_ERROR:\n        # fix fileType field on the offending input variable and retry\n        ...\n    raise","preventionTips":["Generate input schemas via the console editor, not by hand","After engine upgrades, re-save old workflows to migrate fileType formats","Keep a JSON schema for DSL inputs and validate exports against it"],"tags":["workflow","file","dsl","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}