{"record":{"id":"15f41d6c1be9699e","repo":"lutzroeder/netron","slug":"unknown-field-tag-this-location-15f41d","errorCode":null,"errorMessage":"Unknown field '${tag}' ${this.location()}","messagePattern":"Unknown field '(.+?)' (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"source/caffe2.js","lineNumber":174,"sourceCode":"            if (context) {\n                switch (context.type) {\n                    case 'caffe2.pb':\n                        try {\n                            const reader = await context.read('protobuf.binary');\n                            return caffe2.proto.NetDef.decode(reader);\n                        } catch (error) {\n                            const message = error && error.message ? error.message : error.toString();\n                            throw new caffe2.Error(`File format is not caffe2.NetDef (${message.replace(/\\.$/, '')}).`);\n                        }\n                    case 'caffe2.pbtxt':\n                        try {\n                            const reader = await context.read('protobuf.text');\n                            reader.field = function(tag, message) {\n                                if (message instanceof caffe2.proto.DeviceOption) {\n                                    message[tag] = this.read();\n                                    return;\n                                }\n                                throw new Error(`Unknown field '${tag}' ${this.location()}`);\n                            };\n                            return caffe2.proto.NetDef.decodeText(reader);\n                        } catch (error) {\n                            const message = error && error.message ? error.message : error.toString();\n                            throw new caffe2.Error(`File format is not caffe2.NetDef (${message.replace(/\\.$/, '')}).`);\n                        }\n                    default:\n                        throw new caffe2.Error(`Unsupported Caffe2 predict format '${context.type}'.`);\n                }\n            }\n            return null;\n        };\n        const predict_net = await open(predict);\n        const init_net = await open(init);\n        return new caffe2.Model(metadata, predict_net, init_net);\n    }\n};\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/lutzroeder/netron/blob/d8a543f5f847ef596aa58858d6adcf5d75545f7f/source/caffe2.js#L156-L192","documentation":"The caffe2 text-format (protobuf.text) reader hit a field tag that the NetDef schema does not recognize. netron installs a custom reader.field handler that only tolerates unknown fields on DeviceOption; anything else on NetDef is rejected. The outer catch immediately rewraps it as 'File format is not caffe2.NetDef'.","triggerScenarios":"Opening a .pbtxt/prototxt with context.read('protobuf.text') where the top-level message contains a field not in caffe2.NetDef (e.g. a Caffe V1LayerParameter field like 'layers' or 'input_param').","commonSituations":"Trying to open a Caffe (v1) train_val.prototxt with the caffe2 loader; prototxt written by a newer/older schema; typos in hand-written prototxt.","solutions":["Open the file with the Caffe loader instead of caffe2 (it's a Caffe v1 prototxt)","Check the offending tag and line reported by this.location() and fix or remove it","Regenerate the prototxt from a known-good caffe2 export"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sniff a prototxt before opening\nconst first = (await file.text()).slice(0, 512);\nif (/^\\s*layers\\s*{/m.test(first)) { /* Caffe v1 — don't use caffe2 loader */ }","typeGuard":null,"tryCatchPattern":"try {\n  await openAsCaffe2(file);\n} catch (e) {\n  if (/File format is not caffe2\\.NetDef/.test(e.message)) { await openAsCaffe(file); }\n}","preventionTips":["Let netron auto-detect the format instead of forcing caffe2","Keep prototxt files schema-consistent with the tool that wrote them"],"tags":["caffe2","protobuf-text","unknown-field","format-detection"],"backgroundTag":"unknown-protobuf-field","analyzedSha":"d8a543f5f847ef596aa58858d6adcf5d75545f7f","analyzedAt":"2026-08-27T19:21:42.082Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}