lutzroeder/netron · error · Error
Unknown field '${tag}' ${this.location()}
Error message
Unknown field '${tag}' ${this.location()} What it means
Thrown while parsing a Caffe prototxt (NetParameter text protobuf) when a token key in the text does not correspond to any known field of the message being decoded. The custom reader.field handler only assigns recognized fields and falls through to this error for anything else, annotating it with the current parser location (line).
Source
Thrown at source/caffe.js:53
try {
const reader = await content.read('protobuf.text');
reader.field = function(tag, message) {
const type = message.constructor.name;
if (tag.endsWith('_param') && (type === 'LayerParameter' || type === 'V1LayerParameter' || type === 'V0LayerParameter')) {
message[tag] = caffe.ModelFactory._decodeText(reader);
return;
} else if (message.constructor.name.endsWith('Parameter') || message.constructor.name === 'ParamSpec') {
if (message[tag]) {
if (!Array.isArray(message[tag])) {
message[tag] = [message[tag]];
}
message[tag].push(this.read());
} else {
message[tag] = this.read();
}
return;
}
throw new Error(`Unknown field '${tag}' ${this.location()}`);
};
reader.enum = function(type) {
const token = this.token();
this.next();
this.semicolon();
if (!Object.prototype.hasOwnProperty.call(type, token)) {
const value = Number.parseInt(token, 10);
if (!Number.isNaN(token - value)) {
return value;
}
return token;
}
return type[token];
};
if (/MobileNetSSD_train_template.prototxt/.exec(identifier)) {
reader.integer = function() {
const token = this.token();
const value = Number.parseInt(token, 10);View on GitHub (pinned to d8a543f5f8)
Solutions
- Open the prototxt at the reported location() line and check the field name for typos or dialect-specific syntax
- Remove or comment out fields not present in the Caffe NetParameter schema you are targeting
- Regenerate the prototxt with the matching Caffe version (fields must exist in the schema the library bundles)
- Switch loaders if the file is actually another format
Example fix
# before
input_shape: { dim: 1 dim: 3 dim: 224 dim: 224 }
input: "data"
# after
input: "data"
input_dim: 1
input_dim: 3
input_dim: 224
input_dim: 224 Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check prototxt keys against the schema before loading
const known = new Set(['name','input','input_dim','layer','layers','state','phase',/* ...*/]);
for (const line of prototxt.split('\n')) {
const m = line.match(/^\s*([a-z_\d]+)\s*[:{]/);
if (m && !known.has(m[1])) console.warn('Unknown field', m[1]);
} Try / catch
try {
await context.open(file);
} catch (e) {
if (/Unknown field/.test(e.message)) {
// e.message includes location(); jump user to that line for editing
highlightLine(e.message);
} else throw e;
} Prevention
- Lint prototxt files against the target Caffe schema before loading
- Generate prototxt programmatically rather than hand-editing
- Pin the Caffe schema version your tooling expects
When it happens
Trigger: Calling the Caffe open()/openNetParameterText() flow on a .prototxt that contains a field name unknown to the bundled caffe.proto schema — e.g. newer Caffe/Jolicloud additions like input_shape used in an unsupported position, typos, or non-Caffe syntax.
Common situations: Prototxt files from newer/patched Caffe forks (fields the bundled schema predates); hand-edited prototxt with typos; SSID/NNU or PyCaffe-exported files with dialect differences; passing a Torch/ONNX text file to the Caffe loader.
Related errors
- Unknown field '${tag}'${this.location()}
- Unknown field '${tag}' ${this.location()}
- Unknown field '${tag}' ${this.location()}
AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27).
Data as JSON: /api/errors/006ece19ce538c32.
Report an issue: GitHub.