iflytek/astron-agent · error · CustomException

ENG_PROTOCOL_VALIDATE_ERROR

ENG_PROTOCOL_VALIDATE_ERROR

Error message

Error: fileType field is incorrect

What it means

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.

Solutions

  1. Correct the variable's fileType field to a supported file-type declaration (e.g. proper allowed_file_type list) in the DSL
  2. Re-save the workflow input schema via the console editor so fileType is generated in the current format
  3. Check the engine version's expected FileVarInfo schema and migrate old DSLs accordingly
  4. Wrap DSL loading to validate file variable schemas before constructing the engine

Example fix

# before
"fileType": "document"  # unsupported value
# after
"fileType": {"allowedFileTypes": ["pdf", "docx"], "required": true}
Defensive patterns

Strategy: validation

Validate before calling

def validate_file_vars(dsl):
    for v in dsl.get("inputs", []):
        if v.get("type") == "file" and not is_valid_file_type_decl(v.get("fileType")):
            raise ValueError(f"bad fileType on {v['name']}")

Type guard

def is_valid_file_type_decl(ft):
    return isinstance(ft, dict) and bool(ft.get("allowedFileTypes"))

Try / catch

try:
    vars_ = File.has_file_in_dsl(dsl)
except CustomException as e:
    if e.err_code == CodeEnum.ENG_PROTOCOL_VALIDATE_ERROR:
        # fix fileType field on the offending input variable and retry
        ...
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/389a71baabd35ee0. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/entities/file.py:88

                    node_outputs = node.get("data").get("outputs")
                    for output in node_outputs:
                        file_flag = output.get("fileType")
                        if file_flag is None:
                            continue
                        await span.add_info_event_async(f"fileType: {file_flag}")
                        if file_flag == "file":
                            has_file = True
                            var_name = output.get("name")
                            var_type = output.get("schema", {}).get("type", "")
                            allowed_file_type = output.get("allowedFileType")[0]
                            is_required = output.get("required", False)
                            file_infos.append(
                                FileVarInfo(
                                    var_name, var_type, allowed_file_type, is_required
                                )
                            )
                        else:
                            raise CustomException(
                                err_code=CodeEnum.ENG_PROTOCOL_VALIDATE_ERROR,
                                err_msg="Error: fileType field is incorrect",
                            )
        except CustomException as err:
            raise err
        except Exception as e:
            span.add_error_event(
                "Failed to get file variable information from protocol"
            )
            span.record_exception(e)
            raise e

        return file_infos, has_file

    def get_file_url(self, file_id: str) -> str:
        """
        Get file information from OSS based on file_id and return the file access URL.

View on GitHub (pinned to 5e758547a8)