lutzroeder/netron · error · Error
Undefined node type.
Error message
Undefined node type.
What it means
coreml.Node's constructor requires obj.type to be truthy; a neural network layer dictionary without a 'type' key is considered invalid. Every CoreML layer must declare its layer type (e.g. 'convolution', 'pooling').
Source
Thrown at source/coreml.js:297
coreml.Value = class {
constructor(name, type, description = null, initializer = null) {
if (typeof name !== 'string') {
throw new coreml.Error(`Invalid value identifier '${JSON.stringify(name)}'.`);
}
this.name = name;
this.type = !type && initializer ? initializer.type : type;
this.description = description;
this.initializer = initializer;
this.quantization = initializer ? initializer.quantization : null;
}
};
coreml.Node = class {
constructor(context, obj) {
if (!obj.type) {
throw new Error('Undefined node type.');
}
if (obj.group) {
this.group = obj.group || null;
}
const type = context.metadata.type(obj.type);
this.type = type ? { ...type } : { name: obj.type };
this.type.name = obj.type.split(':').pop();
this.name = obj.name || '';
this.description = obj.description || '';
this.inputs = (obj.inputs || []).map((argument) => {
const values = argument.value.map((value) => value.value);
return new coreml.Argument(argument.name, values, null, argument.visible);
});
this.outputs = (obj.outputs || []).map((argument) => {
const values = argument.value.map((value) => value.value);
return new coreml.Argument(argument.name, values, null, argument.visible);
});
this.attributes = Object.entries(obj.attributes || []).map(([name, value]) => {View on GitHub (pinned to d8a543f5f8)
Solutions
- Update netron to a version supporting your CoreML spec version
- Inspect the model with coremltools to confirm layers are valid
- Re-save/convert the model with current coremltools
- If the layer is genuinely type-less, report the model as a netron issue
Defensive patterns
Strategy: validation
Validate before calling
const layers = spec?.neuralNetwork?.layers ?? [];
if (layers.some((l) => !l.type)) throw new Error('model has untyped layers'); Type guard
const hasType = (l) => Boolean(l && typeof l.type === 'string' && l.type.length);
Try / catch
try { model = new coreml.Model(...); } catch (e) { if (/Undefined node type/.test(e.message)) { /* skip or report the bad layer */ } } Prevention
- Validate layers with coremltools before inspection
- Keep netron updated alongside CoreML spec versions
When it happens
Trigger: Decoding a CoreML .mlmodel whose NeuralNetwork.layers array contains an entry with no/empty 'type' key; often when the FeatureType/protobuf mapping produced an unexpected object shape.
Common situations: Newer CoreML layer kinds not mapped by the installed netron version; corrupted or hand-constructed mlmodel; wrong protobuf branch decoded as layers.
Related errors
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/bc09f3228132b66d.
Report an issue: GitHub.