{"record":{"id":"3c72c9a36dba6c16","repo":"pinpoint-apm/pinpoint","slug":"invalid-key-container-id-containerid","errorCode":null,"errorMessage":"invalid ${KEY_CONTAINER_ID}=${containerId}","messagePattern":"invalid (.+?)=(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceMapperUtils.java","lineNumber":217,"sourceCode":"            throw new IllegalArgumentException(\"invalid \" + sourceKey + \"=\" + id);\n        }\n        return new AgentAuth(id, resolveAgentName(agentNameOverride, id));\n    }\n\n    private static AgentAuth toContainerAgentAuth(String containerId, String agentNameOverride) {\n        // Docker/containerd full ID: 64 lowercase hex chars (SHA256).\n        // Truncate to first 16 bytes → 22-char URL-safe Base64 (same format as UUID case).\n        if (containerId.length() == CONTAINER_ID_FULL_HEX_LEN) {\n            try {\n                final byte[] bytes = Base16Utils.decodeToBytes(containerId);\n                final byte[] prefix = Arrays.copyOf(bytes, AGENT_ID_HASH_PREFIX_BYTES);\n                return new AgentAuth(Base64Utils.encode(prefix), resolveAgentName(agentNameOverride, containerId));\n            } catch (IllegalArgumentException ignore) {\n                // not valid hex, fall through to treat as plain agentId\n            }\n        }\n        if (!IdValidateUtils.validateId(containerId, PinpointConstants.AGENT_ID_MAX_LEN)) {\n            throw new IllegalArgumentException(\"invalid \" + KEY_CONTAINER_ID + \"=\" + containerId);\n        }\n        return new AgentAuth(containerId, resolveAgentName(agentNameOverride, containerId));\n    }\n\n    public static String getServiceName(Map<String, AttributeValue> attributes) {\n        // TEMPORARY: OTLP spans are always assigned the DEFAULT serviceName, matching the native\n        // agent's effective default (SpanOwner.serviceName = ServiceUid.DEFAULT_SERVICE_UID_NAME).\n        // Rationale: OTLP applications are registered under DEFAULT_SERVICE_UID (see\n        // OtlpTraceExportService), and the web queries service-keyed stores (e.g. the Pinot heatmap\n        // sortKey = serviceName#applicationName) with DEFAULT. Deriving serviceName from\n        // pinpoint.serviceName / service.namespace here produced a key that never matched the web\n        // query, so OTLP transactions were missing from those views.\n        // Revisit once the serviceUid policy for OTLP is decided; the attribute-based resolution\n        // below should be restored (and validated against DEFAULT_SERVICE_UID registration) then.\n        //\n        //   String serviceName = AttributeUtils.getAttributeStringValue(attributes, KEY_PINPOINT_SERVICE_NAME, null);\n        //   if (serviceName == null) {\n        //       serviceName = AttributeUtils.getAttributeStringValue(attributes, KEY_SERVICE_NAMESPACE, null);","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/otlptrace/otlptrace-collector/src/main/java/com/navercorp/pinpoint/otlp/trace/collector/mapper/OtlpTraceMapperUtils.java#L199-L235","documentation":"toContainerAgentAuth converts a container.id attribute into an AgentAuth. It tries the 64-hex Docker SHA256 path (truncating to a Base64 agentId) and otherwise validates the raw containerId as a plain agentId; failure of IdValidateUtils (AGENT_ID_MAX_LEN) throws this IllegalArgumentException naming the container-id key.","triggerScenarios":"A container.id attribute value that is neither a 64-char hex Docker ID nor a value passing validateId — e.g. a pod-UID-style UUID with hyphens, a container name with invalid chars, or a truncated/odd-length hex string.","commonSituations":"CRI runtimes exposing pod UIDs instead of Docker container IDs; manual config using container names with underscores; version changes where container IDs are no longer 64-hex (e.g. some containerd/Podman setups).","solutions":["Provide the full 64-char lowercase hex container ID (docker inspect --format '{{.Id}}')","Prefer service.instance.id=$(uuidgen) as the per-instance identifier instead","Attach an explicit valid pinpoint.agentId attribute to bypass container-id parsing","Verify the container runtime exports IDs in the expected hex format"],"exampleFix":"// before\nattributes.put(\"container.id\", \"my_container\");\n// after\nattributes.put(\"container.id\", \"a1b2c3...64-hex-chars\");","handlingStrategy":"validation","validationCode":"if (containerId != null && !containerId.matches(\"[0-9a-f]{64}\") && !IdValidateUtils.validateId(containerId, PinpointConstants.AGENT_ID_MAX_LEN)) {\n    throw new IllegalArgumentException(\"invalid container.id=\" + containerId);\n}","typeGuard":"boolean isDockerContainerId(String id) { return id != null && id.matches(\"[0-9a-f]{64}\"); }","tryCatchPattern":null,"preventionTips":["Export the full 64-char hex container ID, not the container name","Fall back to service.instance.id when the runtime does not expose hex IDs","Check container runtime changes (Docker -> containerd) for ID format shifts"],"tags":["otlp","validation","container"],"backgroundTag":"invalid-identifier-format","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"}