{"record":{"id":"aece28f42b5b48a8","repo":"pinpoint-apm/pinpoint","slug":"invalid-transactionid-transactionid","errorCode":null,"errorMessage":"invalid transactionId:${transactionId}","messagePattern":"invalid transactionId:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/util/TransactionIdUtils.java","lineNumber":92,"sourceCode":"        // write prefix String\n        offset = BytesUtils.writeVar32(zigZagAgentIdLength, buffer, offset);\n        if (agentIdBytes != null) {\n            offset = BytesUtils.writeBytes(buffer, offset, agentIdBytes);\n        }\n        offset = BytesUtils.writeVar64(agentStartTime, buffer, offset);\n        BytesUtils.writeVar64(transactionSequence, buffer, offset);\n        return buffer;\n    }\n\n    public static TransactionId parseTransactionId(final String transactionId) {\n        Objects.requireNonNull(transactionId, \"transactionId\");\n\n        final int agentIdIndex = nextIndex(transactionId, 0);\n        if (agentIdIndex == -1) {\n            throw new IllegalArgumentException(\"agentIndex not found:\" + transactionId);\n        }\n        if (!IdValidateUtils.checkId(transactionId, 0, agentIdIndex)) {\n            throw new IllegalArgumentException(\"invalid transactionId:\" + transactionId);\n        }\n        final String agentId = transactionId.substring(0, agentIdIndex);\n\n        final int agentStartTimeIndex = nextIndex(transactionId, agentIdIndex + 1);\n        if (agentStartTimeIndex == -1) {\n            throw new IllegalArgumentException(\"agentStartTimeIndex not found:\" + transactionId);\n        }\n        final long agentStartTime = parseLong(transactionId, agentIdIndex + 1, agentStartTimeIndex);\n\n        int transactionSequenceIndex = nextIndex(transactionId, agentStartTimeIndex + 1);\n        if (transactionSequenceIndex == -1) {\n            // next index may not exist since default value does not have a delimiter after transactionSequence.\n            // may need fixing when id spec changes\n            transactionSequenceIndex = transactionId.length();\n        }\n        final long transactionSequence = parseLong(transactionId, agentStartTimeIndex + 1, transactionSequenceIndex);\n        return TransactionId.of(agentId, agentStartTime, transactionSequence);\n    }","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/util/TransactionIdUtils.java#L74-L110","documentation":"After locating the agentId segment, parseTransactionId validates it with IdValidateUtils.checkId. If the agentId substring contains characters or a length outside the allowed identifier rules, an IllegalArgumentException 'invalid transactionId:<id>' is thrown, because a malformed agentId means the string is not a legitimate Pinpoint transactionId.","triggerScenarios":"Calling TransactionIdUtils.parseTransactionId with a string whose first delimiter-delimited segment (the agentId) fails IdValidateUtils.checkId — e.g. contains illegal characters (spaces, '/', unicode), exceeds the max length, or is empty before the first delimiter.","commonSituations":"Agent applicationName/agentId configured with disallowed characters when the agent was installed, then that id is embedded in transactionIds the parser rejects; transactionId strings reconstructed by hand or truncated in logs/dashboards; copy-pasted ids carrying whitespace or HTML entities.","solutions":["Inspect the agentId segment of the string against IdValidateUtils rules (allowed characters and max length) and fix the source string.","Fix the agent's applicationName/agentId configuration to use only valid identifier characters so future transactionIds parse.","Validate the transactionId with the same check before parsing; trim whitespace and URL-decode inputs coming from links or logs."],"exampleFix":"// before\nTransactionId id = TransactionIdUtils.parseTransactionId(rawId.trim());\n// after\nif (IdValidateUtils.checkId(rawId.trim(), 0, rawId.indexOf(TransactionIdUtils.TRANSACTION_ID_DELIMITER))) {\n    TransactionId id = TransactionIdUtils.parseTransactionId(rawId.trim());\n}","handlingStrategy":"validation","validationCode":"boolean validAgentSegment(String id) {\n    int i = id.indexOf(TransactionIdUtils.TRANSACTION_ID_DELIMITER);\n    return i > 0 && IdValidateUtils.checkId(id, 0, i);\n}\n// call parseTransactionId only if validAgentSegment(rawId)","typeGuard":null,"tryCatchPattern":"try {\n    TransactionId id = TransactionIdUtils.parseTransactionId(rawId);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"invalid transactionId\")) {\n        logger.warn(\"transactionId has invalid agentId segment: {}\", rawId);\n    } else { throw e; }\n}","preventionTips":["Configure agentId/applicationName with only characters accepted by IdValidateUtils (alphanumerics, '-', '_', '.', limited length).","Trim and URL-decode ids sourced from logs, links, or user input.","Reject suspicious ids at the boundary with the same checkId validation.","Keep pinpoint agent and collector versions aligned so id formats stay compatible."],"tags":["java","parsing","validation","transactionid"],"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-14T11:17:12.474Z"}