lutzroeder/netron · error · Error
Undefined node type.
Error message
Undefined node type.
What it means
espresso.Node's constructor throws when the deserialized espresso layer object has no 'type'. Espresso (Apple's ANE graph format) layers always carry a type string; absence means the blob was misparsed.
Source
Thrown at source/espresso.js:149
espresso.Value = class {
constructor(name, type, description = null, initializer = null) {
if (typeof name !== 'string') {
throw new espresso.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;
}
};
espresso.Node = class {
constructor(metadata, obj) {
if (!obj.type) {
throw new Error('Undefined node type.');
}
const type = 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 espresso.Argument(argument.name, values, null, argument.visible);
});
this.outputs = (obj.outputs || []).map((argument) => {
const values = argument.value.map((value) => value.value);
return new espresso.Argument(argument.name, values, null, argument.visible);
});
this.attributes = Object.entries(obj.attributes || []).map(([name, value]) => {
const schema = metadata.attribute(obj.type, name);
let type = null;
let visible = true;View on GitHub (pinned to d8a543f5f8)
Solutions
- Update netron (espresso schema support changes frequently with macOS releases)
- Validate the JSON: every entry in layers should have a 'type' string
- Re-export the espresso model from the original pipeline
- File a netron issue with the (sanitized) JSON if schema changed
Defensive patterns
Strategy: validation
Validate before calling
const json = JSON.parse(await file.text());
const bad = (json.network?.layers ?? json.layers ?? []).filter((l) => !l.type);
if (bad.length) console.warn('untyped layers:', bad.length); Type guard
const isEspressoLayer = (l) => l && typeof l === 'object' && typeof l.type === 'string';
Try / catch
try { new espresso.Model(...); } catch (e) { if (/Undefined node type/.test(e.message)) { /* schema mismatch — update viewer */ } } Prevention
- Pin macOS/Xcode and netron versions together
- Re-serialize espresso JSON with JSON.parse/stringify round-trip to catch structural damage
When it happens
Trigger: Opening an .espresso.json or compiled espresso model where a layers array entry lacks the 'type' key, or where the JSON structure shifted so obj is not a layer dict.
Common situations: espresso JSON produced by a newer macOS/Xcode version with a changed schema; truncated file; netron version predating new layer encodings.
Related errors
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/23b2214ed7cebc55.
Report an issue: GitHub.