{"record":{"id":"b1e27dc829dfa78c","repo":"alibaba/nacos","slug":"resource-not-found-b1e27d","errorCode":"RESOURCE_NOT_FOUND","errorMessage":"certain config history for nid = %s not exist","messagePattern":"certain config history for nid = (.+?) not exist","errorType":"http","errorClass":"NacosApiException","httpStatus":404,"severity":"warning","filePath":"console/src/main/java/com/alibaba/nacos/console/handler/impl/inner/config/HistoryInnerHandler.java","lineNumber":69,"sourceCode":"    \n    private final HistoryService historyService;\n    \n    @Autowired\n    public HistoryInnerHandler(HistoryService historyService) {\n        this.historyService = historyService;\n    }\n    \n    @Override\n    public ConfigHistoryDetailInfo getConfigHistoryInfo(String dataId, String group,\n        String namespaceId, Long nid)\n        throws NacosException {\n        ConfigHistoryDetailInfo result;\n        try {\n            ConfigHistoryInfo configHistoryInfo =\n                historyService.getConfigHistoryInfo(dataId, group, namespaceId, nid);\n            result = ResponseUtil.transferToConfigHistoryDetailInfo(configHistoryInfo);\n        } catch (DataAccessException e) {\n            throw new NacosApiException(HttpStatus.NOT_FOUND.value(), ErrorCode.RESOURCE_NOT_FOUND,\n                \"certain config history for nid = \" + nid + \" not exist\");\n        }\n        return result;\n    }\n    \n    @Override\n    public Page<ConfigHistoryBasicInfo> listConfigHistory(String dataId, String group,\n        String namespaceId,\n        Integer pageNo, Integer pageSize) throws NacosException {\n        Page<ConfigHistoryInfo> configHistoryInfoPage =\n            historyService.listConfigHistory(dataId, group, namespaceId,\n                pageNo, pageSize);\n        Page<ConfigHistoryBasicInfo> result = new Page<>();\n        result.setPagesAvailable(configHistoryInfoPage.getPagesAvailable());\n        result.setPageNumber(configHistoryInfoPage.getPageNumber());\n        result.setTotalCount(configHistoryInfoPage.getTotalCount());\n        result.setPageItems(\n            configHistoryInfoPage.getPageItems().stream()","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console/src/main/java/com/alibaba/nacos/console/handler/impl/inner/config/HistoryInnerHandler.java#L51-L87","documentation":"Thrown by HistoryInnerHandler.getConfigHistoryInfo when looking up a specific config history detail by nid. If the underlying historyService lookup raises a Spring DataAccessException, it is translated to NacosApiException with HTTP 404 and ErrorCode.RESOURCE_NOT_FOUND. Practically this means no history row exists for that nid in that namespace/group/dataId.","triggerScenarios":"Querying GET config-history detail with a nid that does not exist (deleted, never created, or wrong namespace/group/dataId).","commonSituations":"Stale nid from an old/cleaned history; wrong namespace or dataId/group mismatch; history retention expired; a copied link referencing a nid from another environment.","solutions":["Confirm the nid belongs to the given dataId/group/namespaceId by listing history first.","Verify the history table still contains that row; history may be pruned by retention settings.","Use the list-history endpoint to obtain valid nids before requesting a detail."],"exampleFix":"// before\nhistoryHandler.getConfigHistoryInfo(dataId, group, ns, 99999L); // wrong/stale nid\n\n// after\nPage<ConfigHistoryBasicInfo> page = historyHandler.listConfigHistory(dataId, group, ns, 1, 10);\nLong validNid = page.getPageItems().get(0).getId();\nhistoryHandler.getConfigHistoryInfo(dataId, group, ns, validNid);","handlingStrategy":"validation","validationCode":"// Confirm the nid exists in the history list before fetching detail\nPage<ConfigHistoryBasicInfo> p = historyHandler.listConfigHistory(dataId, group, ns, 1, 10);\nSet<Long> validNids = p.getPageItems().stream()\n    .map(ConfigHistoryBasicInfo::getId).collect(Collectors.toSet());\nif (!validNids.contains(nid)) {\n    throw new NoSuchResourceException(\"history nid not found: \" + nid);\n}\nhistoryHandler.getConfigHistoryInfo(dataId, group, ns, nid);","typeGuard":"// Java: boolean guard that the nid belongs to the dataId/group/ns\nboolean nidExists = historyHandler.listConfigHistory(dataId, group, ns, 1, 100)\n    .getPageItems().stream().anyMatch(h -> nid.equals(h.getId()));","tryCatchPattern":"try {\n    return historyHandler.getConfigHistoryInfo(dataId, group, ns, nid);\n} catch (NacosApiException e) {\n    if (e.getDetailErrCode() == ErrorCode.RESOURCE_NOT_FOUND.getCode()) {\n        return null; // or 404 to caller with a clear message\n    }\n    throw e;\n}","preventionTips":["Obtain nids from the history list endpoint, never hard-code them.","Scope nid lookups by the correct namespace/group/dataId.","Be aware history rows can be pruned by retention settings."],"tags":["config","history","not-found","console"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}