{"record":{"id":"59cb1ed9dfa6ddb7","repo":"pinpoint-apm/pinpoint","slug":"failed-to-insert-agent-applicationname-agent","errorCode":null,"errorMessage":"Failed to insert agent. applicationName: {}, agentId: {}","messagePattern":"Failed to insert agent\\. applicationName: (.+?), agentId: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/service/HbaseOtlpApplicationIndexV2Service.java","lineNumber":50,"sourceCode":"    private final Logger logger = LogManager.getLogger(this.getClass());\n\n    private final ApplicationDao applicationDao;\n    private final AgentIdDao agentIdDao;\n\n    public HbaseOtlpApplicationIndexV2Service(ApplicationDao applicationDao,\n                                              AgentIdDao agentIdDao) {\n        this.applicationDao = Objects.requireNonNull(applicationDao, \"ApplicationDao\");\n        this.agentIdDao = Objects.requireNonNull(agentIdDao, \"agentIdDao\");\n    }\n\n    // TODO get serviceUid from agentInfoBo\n    public void insert(ServiceUidSupplier serviceUidSupplier, AgentInfoBo agentInfoBo) {\n        try {\n            ServiceUid serviceUid = serviceUidSupplier.get();\n            applicationDao.insert(serviceUid.getUid(), agentInfoBo.getApplicationName(), agentInfoBo.getServiceTypeCode());\n            agentIdDao.insert(serviceUid.getUid(), agentInfoBo);\n        } catch (Exception e) {\n            logger.warn(\"Failed to insert agent. applicationName: {}, agentId: {}\", agentInfoBo.getApplicationName(), agentInfoBo.getAgentId(), e);\n        }\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":54,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/service/HbaseOtlpApplicationIndexV2Service.java#L32-L54","documentation":"HbaseOtlpApplicationIndexV2Service.insert wraps all failures from applicationDao.insert and agentIdDao.insert (HBase writes of the application index v2 and agent-id mappings) in a try/catch and logs this warning. It means the agent's application/service-uid index could not be persisted to HBase; the exception is swallowed, so the caller never learns the insert failed.","triggerScenarios":"Any exception thrown by serviceUidSupplier.get(), applicationDao.insert(...) or agentIdDao.insert(...) for an AgentInfoBo, e.g. HBase connection failure, table missing, or a null ServiceUid from the supplier.","commonSituations":"HBase region/thrift server down or unreachable from the collector; missing or misconfigured HBase tables for the v2 application index; NPE from a ServiceUidSupplier that returns null; retried duplicate agent registrations during collector restarts.","solutions":["Check HBase connectivity and ZooKeeper/quorum settings in the collector's HBase client configuration.","Verify the v2 application-index and agent-id HBase tables exist and the collector user has write permissions (run table creation/migration scripts).","Inspect the logged stack trace to identify the root cause (IO vs NPE from serviceUidSupplier) and fix the supplier to never return null ServiceUid.","Retry the agent registration; since the log is a swallowed warning, re-send the agent info or verify downstream lookups tolerate the missing index."],"exampleFix":"// before: supplier may return null and NPE is swallowed\nServiceUid serviceUid = serviceUidSupplier.get();\n// after: guard before HBase writes\nServiceUid serviceUid = serviceUidSupplier.get();\nif (serviceUid == null) {\n    logger.warn(\"Skip agent insert: null serviceUid for {}\", agentInfoBo.getApplicationName());\n    return;\n}","handlingStrategy":"validation","validationCode":"ServiceUid serviceUid = serviceUidSupplier.get();\nif (serviceUid == null || serviceUid.getUid() == null) {\n    throw new IllegalArgumentException(\"serviceUid supplier returned null; agent insert would fail\");\n}\nif (agentInfoBo == null || agentInfoBo.getApplicationName() == null || agentInfoBo.getAgentId() == null) {\n    throw new IllegalArgumentException(\"agentInfoBo missing required fields for insert\");\n}","typeGuard":"boolean isInsertable(AgentInfoBo bo, ServiceUid uid) {\n    return bo != null && bo.getAgentId() != null && bo.getApplicationName() != null && uid != null && uid.getUid() != null;\n}","tryCatchPattern":"try {\n    applicationIndexV2Service.insert(serviceUidSupplier, agentInfoBo);\n} catch (Exception e) {\n    // insert() already swallows exceptions, so this rarely fires;\n    // instead check applicationIdDao lookup afterwards to detect silent failure\n    logger.error(\"agent index insert reported failure; verify HBase availability\", e);\n}","preventionTips":["Verify HBase tables for the v2 application index exist before starting the collector.","Ensure ServiceUidSupplier implementations never return null.","Monitor collector logs for this warning as the insert silently swallows exceptions.","Run HBase health checks (region server availability) as part of collector startup."],"tags":["hbase","write-failure","agent-registration","swallowed-exception"],"backgroundTag":"database-write-failed","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"}