{"record":{"id":"d5b5fdd7ebb19e2d","repo":"alibaba/nacos","slug":"unknown-objectname-field-field","errorCode":null,"errorMessage":"Unknown {objectName} field: {field}","messagePattern":"Unknown (.+?) field: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java","lineNumber":290,"sourceCode":"        try (JsonParser parser = STRICT_JSON_FACTORY.createParser(bytes)) {\n            if (parser.nextToken() == null) {\n                throw new IllegalArgumentException(\"AgentVersionContent JSON must not be empty\");\n            }\n            parser.skipChildren();\n            if (parser.nextToken() != null) {\n                throw new IllegalArgumentException(\n                    \"AgentVersionContent must contain one JSON value\");\n            }\n        } catch (IOException e) {\n            throw new IllegalArgumentException(\"Invalid AgentVersionContent\", e);\n        }\n    }\n    \n    private static void rejectUnknownFields(Map<?, ?> value, Set<String> fields,\n        String objectName) {\n        for (Object field : value.keySet()) {\n            if (!fields.contains(field)) {\n                throw new IllegalArgumentException(\"Unknown \" + objectName + \" field: \" + field);\n            }\n        }\n    }\n    \n    /**\n     * Immutable persisted bytes, digest and byte count for one Agent Version content object.\n     */\n    public static final class SerializedContent {\n        \n        private final byte[] bytes;\n        \n        private final String contentDigest;\n        \n        private SerializedContent(byte[] bytes, String contentDigest) {\n            this.bytes = bytes;\n            this.contentDigest = contentDigest;\n        }\n        ","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java#L272-L308","documentation":"Thrown by rejectUnknownFields when a JSON object contains a field not in the allowed set for its level. The storage projection has a closed schema: AgentVersionContent allows {kind, schemaVersion, callInterfaces}; AgentCallInterface allows {protocol, protocolVersion, descriptorMediaType, nativeDescriptor, endpointSourceOrder, declaredEndpoints}; DeclaredEndpoint allows {uri, transport, priority, weight, metadata}.","triggerScenarios":"Deserializing content whose JSON includes an extra field at any level — e.g. a top-level 'version' field, a callInterface with 'description', or an endpoint with 'region'. The shape check walks the JSON before typed binding and rejects the unknown field by name.","commonSituations":"A client or older serializer wrote content with fields no longer (or never) in the storage schema, or a hand-crafted JSON blob includes extra metadata at the wrong nesting level.","solutions":["Remove the offending field named in the message from the persisted JSON.","Re-serialize through AgentVersionContentSerializer.serialize which only emits allowed fields.","If the field is legitimately needed, add it to the corresponding FIELDS set and update the spec."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// allowed top-level fields\nSet<String> allowed = Set.of(\"kind\", \"schemaVersion\", \"callInterfaces\");\nfor (String f : yourFields) {\n    if (!allowed.contains(f)) {\n        throw new IllegalArgumentException(\"disallowed field: \" + f);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    return AgentVersionContentSerializer.deserialize(bytes);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown \")) {\n        log.warn(\"rejecting content with unknown field: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Always produce content via serialize() which emits only allowed fields.","Do not hand-edit persisted JSON.","When extending the schema, add fields to the FIELDS sets and update the spec."],"tags":["deserialization","agent-version","schema","unknown-field","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}