{"record":{"id":"b6ebe35fdc592201","repo":"pinpoint-apm/pinpoint","slug":"service-not-found-servicename-applicationnam","errorCode":null,"errorMessage":"Service not found. serviceName: {}, applicationName: {}","messagePattern":"Service not found\\. serviceName: (.+?), applicationName: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"web/src/main/java/com/navercorp/pinpoint/web/realtime/AgentLookupServiceImpl.java","lineNumber":64,"sourceCode":"    private final ApplicationAgentListService applicationAgentListService;\n    private final ServiceModelResolver serviceModelResolver;\n    private final Duration recentness;\n\n    AgentLookupServiceImpl(ApplicationAgentListService applicationAgentListService,\n                           ServiceModelResolver serviceModelResolver,\n                           Duration recentness) {\n        this.applicationAgentListService = Objects.requireNonNull(applicationAgentListService, \"applicationAgentListService\");\n        this.serviceModelResolver = Objects.requireNonNull(serviceModelResolver, \"serviceModelResolver\");\n        this.recentness = Objects.requireNonNullElse(recentness, Duration.ZERO);\n    }\n\n    @Override\n    public List<ClusterKeyAndMetadata> getRecentAgents(String serviceName, String applicationName) {\n        final Service service;\n        try {\n            service = serviceModelResolver.getService(serviceName);\n        } catch (ServiceNotFoundException e) {\n            logger.warn(\"Service not found. serviceName: {}, applicationName: {}\", serviceName, applicationName);\n            return List.of();\n        }\n\n        long now = System.currentTimeMillis();\n        long from = now - recentness.toMillis();\n        Range between = Range.between(from, now);\n        TimeWindow timeWindow = new TimeWindow(between);\n\n        return intoClusterKeyAndMetadataList(service.getServiceName(),\n                this.applicationAgentListService.activeStatisticsAgentList(service, applicationName, null,\n                        timeWindow,\n                        ACTUAL_AGENT_INFO_PREDICATE\n                ));\n    }\n\n    private static List<ClusterKeyAndMetadata> intoClusterKeyAndMetadataList(String serviceName, List<AgentAndStatus> agentAndStatusList) {\n        return agentAndStatusList.stream()\n                .map(AgentAndStatus::getAgentInfo)","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web/src/main/java/com/navercorp/pinpoint/web/realtime/AgentLookupServiceImpl.java#L46-L82","documentation":"AgentLookupServiceImpl.getRecentAgents resolves the Service for the given serviceName to look up recently active agents. If the service does not exist (ServiceNotFoundException), it logs this warning and returns an empty list instead of failing, so callers see 'no recent agents' for unknown services.","triggerScenarios":"Calling getRecentAgents (directly or via the realtime agent-lookup API) with a serviceName that serviceModelResolver cannot resolve — typically a typo or a service removed from the service registry.","commonSituations":"Frontend passing a stale or misspelled serviceName; service deleted/renamed in the Pinpoint service configuration; user lacking access to a service that appears not to exist; cache lag after service creation.","solutions":["Verify serviceName matches an entry resolvable by serviceModelResolver (check service registry/config)","Handle the empty list on the caller side as 'unknown service' vs 'no agents' distinctly if needed","Refresh/clear the service cache or re-fetch the service list after creating a new service","Validate the serviceName parameter in the API layer before invoking the lookup"],"exampleFix":"// before\nList<ClusterKeyAndMetadata> agents = agentLookupService.getRecentAgents(serviceName, applicationName);\nif (agents.isEmpty()) { /* no agents */ }\n// after\nif (!knownServices.contains(serviceName)) {\n    throw new IllegalArgumentException(\"Unknown service: \" + serviceName);\n}\nList<ClusterKeyAndMetadata> agents = agentLookupService.getRecentAgents(serviceName, applicationName);","handlingStrategy":"fallback","validationCode":"// verify the service exists before looking up agents\nList<Service> services = serviceModelResolver.getAllServices();\nboolean known = services.stream().anyMatch(s -> s.getName().equals(serviceName));\nif (!known) {\n    throw new IllegalArgumentException(\"Unknown service: \" + serviceName);\n}","typeGuard":null,"tryCatchPattern":"List<ClusterKeyAndMetadata> agents = agentLookupService.getRecentAgents(serviceName, applicationName);\nif (agents.isEmpty()) {\n    // distinguish unknown service vs no active agents in UI messaging\n}","preventionTips":["Fetch the service list from the API rather than hard-coding service names","Treat empty results from unknown services as a config problem, not 'no agents'","Re-sync service caches after creating or renaming services"],"tags":["pinpoint","realtime","service-lookup"],"backgroundTag":"resource-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}