{"record":{"id":"0e06066a314a3d5e","repo":"pinpoint-apm/pinpoint","slug":"syntax-error-token","errorCode":null,"errorMessage":"Syntax error. <token>","messagePattern":"Syntax error\\. <token>","errorType":"validation","errorClass":"OracleConnectionStringException","httpStatus":null,"severity":"error","filePath":"agent-module/plugins/oracle-jdbc/src/main/java/com/navercorp/pinpoint/plugin/jdbc/oracle/parser/OracleNetConnectionDescriptorParser.java","lineNumber":142,"sourceCode":"                if (nonTerminalValue) {\n                    throw new OracleConnectionStringException(\"Syntax error. expected token:'(' or ')' :\" + token.getToken());\n                }\n                // We already have checked current token by lookAheadToken(). Proceed to next token.\n                this.tokenizer.nextPosition();\n\n                keyValue.setValue(token.getToken());\n                this.tokenizer.checkEndToken();\n                return keyValue.build();\n            } else if(token.getType() == OracleNetConnectionDescriptorTokenizer.TYPE_KEY_END){\n                this.tokenizer.nextPosition();\n                // This could happen if value is empty.\n                // Does it allow empty value?\n                return keyValue.build();\n            } else {\n                // Cannot reach here because we checked all those possible cases, START, END and LITERAL.\n                // Adding new token type could cause error.\n                // In case of syntax error, EOF can come to here. \n                throw new OracleConnectionStringException(\"Syntax error. \" + token.getToken());\n            }\n        }\n\n    }\n\n}\n","sourceCodeStart":124,"sourceCodeEnd":149,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/plugins/oracle-jdbc/src/main/java/com/navercorp/pinpoint/plugin/jdbc/oracle/parser/OracleNetConnectionDescriptorParser.java#L124-L149","documentation":"parseKeyValue()'s while loop handles TYPE_KEY_START, TYPE_KEY_END and TYPE_LITERAL; the final else is a safety net that fires when an unexpected token type (e.g. an EOF token) reaches the loop, so the descriptor ended in the middle of a key-value structure. The thrown message includes the offending token text for diagnosis.","triggerScenarios":"An EOF or otherwise unhandled token reaching parseKeyValue before a return — e.g. a descriptor ending with '(KEY=' or an unterminated nested block, where lookAheadToken returns EOF instead of null.","commonSituations":"Truncated URLs from environment variables cut off mid-descriptor; secrets/URLs split across lines with the second line lost; template placeholders like ${...} left unexpanded inside the descriptor producing odd tokens.","solutions":["Ensure the descriptor is complete and balanced — every '(' has a matching ')' and every '=' a value","Check that env/template variables in the URL are actually resolved before parsing","Re-copy the URL from the authoritative tnsnames.ora or connection string source","Use the simple jdbc:oracle:thin:@host:port:SID format to sidestep descriptor parsing"],"exampleFix":"// before\nString url = \"jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=\"; // ends mid-value\n// after\nString url = \"jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=svc)))\";","handlingStrategy":"validation","validationCode":"static boolean descriptorWellFormed(String url) {\n    return url != null && url.contains(\"=@\") == false && url.endsWith(\")\") && isBalanced(url)\n        && !url.contains(\"$\"); // reject unexpanded template variables\n}","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(url);\n} catch (OracleConnectionStringException e) {\n    log.error(\"Unexpected token in Oracle descriptor (likely EOF mid-structure): {}\", url, e);\n    throw new ConfigurationException(\"Malformed oracle descriptor\", e);\n}","preventionTips":["Verify template/env variables in the URL are resolved before parsing","Check the full URL made it through config loading (no line-wrapping truncation)","Prefer the simple host:port:SID URL format when possible"],"tags":["jdbc","oracle","url-parsing","unexpected-token"],"backgroundTag":"invalid-url-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"}