alibaba/nacos · warning · NacosApiException

RESOURCE_NOT_FOUND

RESOURCE_NOT_FOUND

Error message

certain config history for nid = %s not exist

What it means

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.

Source

Thrown at console/src/main/java/com/alibaba/nacos/console/handler/impl/inner/config/HistoryInnerHandler.java:69

    
    private final HistoryService historyService;
    
    @Autowired
    public HistoryInnerHandler(HistoryService historyService) {
        this.historyService = historyService;
    }
    
    @Override
    public ConfigHistoryDetailInfo getConfigHistoryInfo(String dataId, String group,
        String namespaceId, Long nid)
        throws NacosException {
        ConfigHistoryDetailInfo result;
        try {
            ConfigHistoryInfo configHistoryInfo =
                historyService.getConfigHistoryInfo(dataId, group, namespaceId, nid);
            result = ResponseUtil.transferToConfigHistoryDetailInfo(configHistoryInfo);
        } catch (DataAccessException e) {
            throw new NacosApiException(HttpStatus.NOT_FOUND.value(), ErrorCode.RESOURCE_NOT_FOUND,
                "certain config history for nid = " + nid + " not exist");
        }
        return result;
    }
    
    @Override
    public Page<ConfigHistoryBasicInfo> listConfigHistory(String dataId, String group,
        String namespaceId,
        Integer pageNo, Integer pageSize) throws NacosException {
        Page<ConfigHistoryInfo> configHistoryInfoPage =
            historyService.listConfigHistory(dataId, group, namespaceId,
                pageNo, pageSize);
        Page<ConfigHistoryBasicInfo> result = new Page<>();
        result.setPagesAvailable(configHistoryInfoPage.getPagesAvailable());
        result.setPageNumber(configHistoryInfoPage.getPageNumber());
        result.setTotalCount(configHistoryInfoPage.getTotalCount());
        result.setPageItems(
            configHistoryInfoPage.getPageItems().stream()

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Confirm the nid belongs to the given dataId/group/namespaceId by listing history first.
  2. Verify the history table still contains that row; history may be pruned by retention settings.
  3. Use the list-history endpoint to obtain valid nids before requesting a detail.

Example fix

// before
historyHandler.getConfigHistoryInfo(dataId, group, ns, 99999L); // wrong/stale nid

// after
Page<ConfigHistoryBasicInfo> page = historyHandler.listConfigHistory(dataId, group, ns, 1, 10);
Long validNid = page.getPageItems().get(0).getId();
historyHandler.getConfigHistoryInfo(dataId, group, ns, validNid);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the nid exists in the history list before fetching detail
Page<ConfigHistoryBasicInfo> p = historyHandler.listConfigHistory(dataId, group, ns, 1, 10);
Set<Long> validNids = p.getPageItems().stream()
    .map(ConfigHistoryBasicInfo::getId).collect(Collectors.toSet());
if (!validNids.contains(nid)) {
    throw new NoSuchResourceException("history nid not found: " + nid);
}
historyHandler.getConfigHistoryInfo(dataId, group, ns, nid);

Type guard

// Java: boolean guard that the nid belongs to the dataId/group/ns
boolean nidExists = historyHandler.listConfigHistory(dataId, group, ns, 1, 100)
    .getPageItems().stream().anyMatch(h -> nid.equals(h.getId()));

Try / catch

try {
    return historyHandler.getConfigHistoryInfo(dataId, group, ns, nid);
} catch (NacosApiException e) {
    if (e.getDetailErrCode() == ErrorCode.RESOURCE_NOT_FOUND.getCode()) {
        return null; // or 404 to caller with a clear message
    }
    throw e;
}

Prevention

When it happens

Trigger: Querying GET config-history detail with a nid that does not exist (deleted, never created, or wrong namespace/group/dataId).

Common situations: 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.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/b1e27dc829dfa78c. Report an issue: GitHub.