# Rule Reference ONNX Doctor includes **64 rules** across multiple providers (10 with auto-fix 🔧). ## ONNX Rules | Code | Name | Severity | Fix | Target | Message | |------|------|----------|-----|--------|---------| | [ONNX001](ONNX001.md) | `empty-graph-name` | error | 🔧 | graph | Graph name of the root graph is empty. | | [ONNX002](ONNX002.md) | `empty-initializer-name` | error | 🔧 | graph | Initializer name is empty. | | [ONNX003](ONNX003.md) | `unsorted-graph-nodes` | error | 🔧 | graph | Graph nodes are not in topological order. | | [ONNX004](ONNX004.md) | `unknown-node-input` | error | | graph | Node input is not produced by a previous node or a graph input. | | [ONNX005](ONNX005.md) | `experimental-op` | warning | | graph | Node uses an experimental operator. | | [ONNX006](ONNX006.md) | `duplicate-value-name` | error | | graph | Multiple values share the same name within a graph. | | [ONNX007](ONNX007.md) | `graph-output-not-produced` | error | 🔧 | graph | Graph output is not produced by any node in the graph. | | [ONNX008](ONNX008.md) | `graph-ssa-violation` | error | | graph | Value name is assigned multiple times, violating SSA form. | | [ONNX009](ONNX009.md) | `initializer-name-conflict` | error | | graph | Initializer name conflicts with a subgraph input name. | | [ONNX010](ONNX010.md) | `invalid-ir-version` | error | | model | Model ir_version is missing or invalid. | | [ONNX011](ONNX011.md) | `ir-version-too-new` | warning | | model | Model ir_version is newer than the checker supports. | | [ONNX012](ONNX012.md) | `duplicate-metadata-keys` | error | | model | Model has duplicate keys in metadata_props. | | [ONNX013](ONNX013.md) | `missing-default-opset` | error | | model | Model (IR version >= 3) is missing opset import for the default ONNX domain. | | [ONNX014](ONNX014.md) | `unexpected-opset-import` | error | | model | Model (IR version < 3) should not have opset_import specified. | | [ONNX015](ONNX015.md) | `missing-opset-for-domain` | error | | node | No opset imported for the node's operator domain. | | [ONNX016](ONNX016.md) | `deprecated-op` | warning | | node | Node uses a deprecated operator. | | [ONNX017](ONNX017.md) | `unregistered-op` | error | | node | No operator schema found for this op type and opset version. | | [ONNX018](ONNX018.md) | `missing-value-type` | info | | value | Value has no type annotation. | | [ONNX019](ONNX019.md) | `undefined-value-dtype` | error | | value | Value's tensor type has UNDEFINED dtype. | | [ONNX020](ONNX020.md) | `undefined-tensor-dtype` | error | | value | Tensor dtype is UNDEFINED. | | [ONNX021](ONNX021.md) | `external-tensor-absolute-path` | error | | value | External tensor location is an absolute path (must be relative). | | [ONNX022](ONNX022.md) | `external-tensor-empty-location` | error | | value | External tensor location is empty. | | [ONNX023](ONNX023.md) | `external-tensor-outside-model-dir` | error | | value | External tensor path points outside the model directory. | | [ONNX024](ONNX024.md) | `external-tensor-inaccessible` | error | | value | External tensor file does not exist or is not accessible. | | [ONNX025](ONNX025.md) | `external-tensor-not-file` | error | | value | External tensor path is not a regular file. | | [ONNX026](ONNX026.md) | `function-empty-name` | error | | function | Function name is empty. | | [ONNX027](ONNX027.md) | `function-missing-domain` | error | | function | Function has no domain (required for IR version >= 8). | | [ONNX028](ONNX028.md) | `function-duplicate-inputs` | error | | function | Function has duplicate input names. | | [ONNX029](ONNX029.md) | `function-duplicate-outputs` | error | | function | Function has duplicate output names. | | [ONNX030](ONNX030.md) | `function-duplicate-attributes` | error | | function | Function has duplicate attribute names. | | [ONNX031](ONNX031.md) | `unsorted-function-nodes` | error | 🔧 | function | Function nodes are not in topological order. | | [ONNX032](ONNX032.md) | `function-ssa-violation` | error | | function | Function is not in SSA form — a value name is assigned multiple times. | | [ONNX033](ONNX033.md) | `function-opset-mismatch` | error | | function | Function opset import is incompatible with the model's opset import. | | [ONNX034](ONNX034.md) | `graph-input-missing-type` | error | | graph | Graph input is missing type information. | | [ONNX035](ONNX035.md) | `graph-input-missing-shape` | error | | graph | Graph input is missing shape information. | | [ONNX036](ONNX036.md) | `graph-output-missing-type` | error | | graph | Graph output is missing type information. | | [ONNX037](ONNX037.md) | `graph-output-missing-shape` | error | | graph | Graph output is missing shape information. | | [ONNX038](ONNX038.md) | `subgraph-variable-shadowing` | error | | graph | Subgraph value name shadows a name from an outer scope. | | [ONNX039](ONNX039.md) | `ref-attr-outside-function` | error | | graph | Reference attribute can only appear in function nodes, not in the main graph or its subgraphs. | | [ONNX101](ONNX101.md) | `duplicate-graph-input` | error | | graph | Duplicate Value object in graph inputs. | | [ONNX102](ONNX102.md) | `duplicate-graph-output` | error | 🔧 | graph | Duplicate Value object in graph outputs. | | [ONNX103](ONNX103.md) | `empty-value-name` | warning | 🔧 | graph | Value has no name set. | | [ONNX104](ONNX104.md) | `initializer-missing-const-value` | error | | graph | Initializer Value has no const_value set. | ## ORT Rules | Code | Name | Severity | Fix | Target | Message | |------|------|----------|-----|--------|---------| | [ORT001](ORT001.md) | `operator-unsupported` | error | | node | Operator is not supported by the execution provider in ONNX Runtime. | | [ORT002](ORT002.md) | `operator-version-unsupported` | error | | node | Operator at this opset version is not supported by the execution provider. | | [ORT003](ORT003.md) | `node-type-inconsistent` | error | | node | Type constraint mismatch for operator inputs/outputs. | | [ORT004](ORT004.md) | `type-unsupported` | error | | node | Data type is not supported by the execution provider for this operator. | | [ORT005](ORT005.md) | `typestr-not-in-schema` | error | | node | Type string is not defined in the operator schema. | ## PB Rules | Code | Name | Severity | Fix | Target | Message | |------|------|----------|-----|--------|---------| | [PB001](PB001.md) | `non-unique-initializer-name` | error | | graph | Tensor initializer names within a graph are not unique. | | [PB002](PB002.md) | `non-unique-sparse-initializer-name` | error | | graph | Sparse tensor initializer names are not unique. | | [PB003](PB003.md) | `attribute-multiple-value-fields` | error | | node | Attribute contains more than one value field. | | [PB004](PB004.md) | `attribute-ref-has-value` | error | | node | Attribute referring to a parent attribute has its own value field set. | | [PB005](PB005.md) | `tensor-data-field-mismatch` | error | | value | Tensor data field does not match the specified data type. | | [PB006](PB006.md) | `zero-element-tensor-has-data` | error | | value | A zero-element tensor should not contain data. | | [PB007](PB007.md) | `multi-value-field-tensor` | error | | value | Tensor with non-zero elements has multiple value fields set. | | [PB008](PB008.md) | `string-data-in-raw-data` | error | | value | STRING data stored in raw_data field. | | [PB009](PB009.md) | `externally-stored-tensor-has-data` | error | | value | Externally stored tensor has inline data fields set. | | [PB010](PB010.md) | `invalid-sparse-indices-size` | error | | value | Sparse tensor indices size does not match NNZ count. | | [PB011](PB011.md) | `sparse-indices-out-of-range` | error | | value | Sparse tensor indices are out of range. | | [PB012](PB012.md) | `unsorted-sparse-indices` | error | | value | Sparse tensor indices are not sorted. | | [PB013](PB013.md) | `sparse-indices-not-lexicographic` | error | | value | Sparse tensor indices are not in lexicographic order. | ## SIM Rules | Code | Name | Severity | Fix | Target | Message | |------|------|----------|-----|--------|---------| | [SIM001](SIM001.md) | `unused-functions` | info | 🔧 | model | Model contains functions that are not referenced by any node. | | [SIM002](SIM002.md) | `unused-opset-imports` | info | 🔧 | model | Model imports opsets that are not used by any node. | | [SIM003](SIM003.md) | `unused-node` | info | 🔧 | node | Node outputs are not consumed. | ```{toctree} :hidden: :maxdepth: 1 ONNX001 ONNX002 ONNX003 ONNX004 ONNX005 ONNX006 ONNX007 ONNX008 ONNX009 ONNX010 ONNX011 ONNX012 ONNX013 ONNX014 ONNX015 ONNX016 ONNX017 ONNX018 ONNX019 ONNX020 ONNX021 ONNX022 ONNX023 ONNX024 ONNX025 ONNX026 ONNX027 ONNX028 ONNX029 ONNX030 ONNX031 ONNX032 ONNX033 ONNX034 ONNX035 ONNX036 ONNX037 ONNX038 ONNX039 ONNX101 ONNX102 ONNX103 ONNX104 ORT001 ORT002 ORT003 ORT004 ORT005 PB001 PB002 PB003 PB004 PB005 PB006 PB007 PB008 PB009 PB010 PB011 PB012 PB013 SIM001 SIM002 SIM003 ```