{"record":{"id":"883741f12be247b4","repo":"alibaba/nacos","slug":"the-latest-label-is-managed-by-the-server","errorCode":null,"errorMessage":"The latest label is managed by the server","messagePattern":"The latest label is managed by the server","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/AgentDetail/AgentDetail.js","lineNumber":282,"sourceCode":"        Message.success('Draft deleted');\n        this.setState({ selectedVersion: '', versionDetail: null }, () => {\n          this.loadOverview();\n          this.loadVersions(1);\n        });\n      })\n      .catch(error => Message.error(error.message))\n      .finally(() => this.setState({ actionLoading: false }));\n  };\n\n  updateLabels = () => {\n    let labels;\n    try {\n      labels = JSON.parse(this.state.labelsText);\n      if (!labels || Array.isArray(labels) || typeof labels !== 'object') {\n        throw new Error('Labels must be a JSON object');\n      }\n      if (Object.prototype.hasOwnProperty.call(labels, 'latest')) {\n        throw new Error('The latest label is managed by the server');\n      }\n    } catch (error) {\n      Message.error(error.message);\n      return;\n    }\n    agentApi\n      .updateLabels({\n        namespaceId: this.namespaceId(),\n        agentName: this.agentName(),\n        labels: JSON.stringify(labels),\n      })\n      .then(() => {\n        Message.success('Labels updated');\n        this.loadOverview();\n      })\n      .catch(error => Message.error(error.message));\n  };\n","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/AgentDetail/AgentDetail.js#L264-L300","documentation":"Thrown by the Agent Detail page when the submitted labels JSON object contains a key named 'latest'. The 'latest' label is reserved and assigned automatically by the Nacos server to mark the most recent agent version, so clients are not allowed to set it manually.","triggerScenarios":"Including \"latest\" as a key in the labels JSON object in the Agent Detail labels editor, e.g. {\"latest\":true}.","commonSituations":"User tries to force a version to be 'latest' or copies labels from server output that already contains the reserved key.","solutions":["Remove the \"latest\" key from the labels object before submitting.","Use a different key name for any custom label you intended.","Rely on the server's automatic 'latest' assignment instead of setting it by hand."],"exampleFix":"// before\n{\"latest\":true,\"env\":\"prod\"}\n\n// after\n{\"env\":\"prod\"}","handlingStrategy":"validation","validationCode":"const RESERVED_LABELS = new Set(['latest']);\nfunction hasReservedLabel(obj) {\n  return Object.keys(obj).some(k => RESERVED_LABELS.has(k));\n}","typeGuard":null,"tryCatchPattern":"const labels = JSON.parse(text);\nif (Object.prototype.hasOwnProperty.call(labels, 'latest')) {\n  Message.error(\"The 'latest' label is managed by the server\");\n  return;\n}","preventionTips":["Show reserved keys as disabled/blocked in the labels UI.","Strip reserved keys automatically with a warning rather than rejecting.","Document the reserved-label list for agent authors."],"tags":["validation","agent","labels","reserved-key","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}