lutzroeder/netron · error · Error

Unknown field '${tag}' ${this.location()}

Error message

Unknown field '${tag}' ${this.location()}

What it means

Thrown by the Paddle text-format (protobuf JSON/text) parser's permissive field hook: while decoding a paddle.ProgramDesc in text format, it encountered a field name it does not recognize on VarType/DenseTensorDesc messages. The hook only remaps legacy names (lod_tensor→dense_tensor, lod_level→legacy_lod_level); anything else is fatal and is wrapped into a paddle.Error reporting the text format is not a ProgramDesc.

Source

Thrown at source/paddle.js:107

                                reader.enum = function(type) {
                                    const token = this.token();
                                    this.next();
                                    this.semicolon();
                                    if (type[token] !== undefined) {
                                        return type[token];
                                    }
                                    if (token === 'LOD_TENSOR') {
                                        return type.DENSE_TENSOR;
                                    }
                                    throw new paddle.Error(`Unknown enum value '${token}' ${this.location()}`);
                                };
                                reader.field = function(tag, message) {
                                    if (message instanceof paddle.proto.VarType && tag === 'lod_tensor') {
                                        message.dense_tensor = paddle.proto.VarType.DenseTensorDesc.decodeText(reader);
                                    } else if (message instanceof paddle.proto.VarType.DenseTensorDesc && tag === 'lod_level') {
                                        message.legacy_lod_level = reader.int32();
                                    } else {
                                        throw new Error(`Unknown field '${tag}' ${this.location()}`);
                                    }
                                };
                                program.desc = paddle.proto.ProgramDesc.decodeText(reader);
                            } catch (error) {
                                const message = error && error.message ? error.message : error.toString();
                                throw new paddle.Error(`File text format is not paddle.ProgramDesc (${message.replace(/\.$/, '')}).`);
                            }
                            break;
                        }
                        case 'paddle.pb': {
                            try {
                                const reader = await context.read('protobuf.binary');
                                program.desc = paddle.proto.ProgramDesc.decode(reader);
                            } catch (error) {
                                const message = error && error.message ? error.message : error.toString();
                                throw new paddle.Error(`File format is not paddle.ProgramDesc (${message.replace(/\.$/, '')}).`);
                            }
                            break;

View on GitHub (pinned to d8a543f5f8)

Solutions

  1. Ensure you are loading a text-format Paddle model with the correct parser (not binary parsed as text).
  2. Check the unknown field name in the message (it is included in the error text) against the Paddle proto schema for your framework version.
  3. Upgrade/downgrade this library to a version whose paddle.js knows the field, or extend the reader.field hook to map it.

Example fix

// before
reader.field = function(tag, message) {
    if (message instanceof paddle.proto.VarType && tag === 'lod_tensor') { ... }
    else throw new Error(`Unknown field '${tag}' ${this.location()}`);
};

// after — add mappings for additional legacy fields
else if (message instanceof paddle.proto.VarType && tag === 'selected_rows') {
    message.selected_rows = paddle.proto.VarType.SelectedRowsDesc.decodeText(reader);
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
    program.desc = paddle.proto.ProgramDesc.decodeText(reader);
} catch (e) {
    if (/Unknown field/.test(e.message)) {
        throw new Error(`Unsupported Paddle text-format field: ${e.message}`);
    }
    throw e;
}

Prevention

When it happens

Trigger: Loading a Paddle text-format .pbtxt model where a VarType contains a field other than the known ones — e.g. 'selected_rows', 'sparse_tensor', 'dense_tensor', or newer/older field names — triggering the reader.field fallback.

Common situations: PaddlePaddle version differences renaming VarType oneof fields, hand-edited pbtxt files, or feeding a binary .pb to the text parser (garbage field names).

Related errors


AI-assisted analysis of lutzroeder/netron@d8a543f5f8 (2026-08-27). Data as JSON: /api/errors/e88a27c86778049a. Report an issue: GitHub.