{"record":{"id":"03e2303e3409aaab","repo":"pinpoint-apm/pinpoint","slug":"syntax-error-expected-token-token","errorCode":null,"errorMessage":"syntax error. Expected token='(' :<token>","messagePattern":"syntax error\\. Expected token='\\(' :<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/OracleNetConnectionDescriptorTokenizer.java","lineNumber":187,"sourceCode":"    public Token lookAheadToken() {\n        if (tokenList.size() <= tokenPosition) {\n            return null;\n        }\n        return tokenList.get(tokenPosition);\n    }\n\n    public void setPosition(int position) {\n        this.position = position;\n    }\n\n    public void checkStartToken() {\n        Token token = this.nextToken();\n        if (token == null) {\n            throw new OracleConnectionStringException(\"parse error. token is null\");\n        }\n        // We can check by == because the token object is singleton.\n        if (!(token == TOKEN_KEY_START_OBJECT)) {\n            throw new OracleConnectionStringException(\"syntax error. Expected token='(' :\" + token.getToken());\n        }\n    }\n\n    public void checkEqualToken() {\n        Token token = this.nextToken();\n        if (token == null) {\n            throw new OracleConnectionStringException(\"parse error. token is null. Expected token='='\");\n        }\n        // We can check by == because the token object is singleton.\n        if (!(token == TOKEN_EQUAL_OBJECT)) {\n            throw new OracleConnectionStringException(\"Syntax error. Expected token='=' :\" + token.getToken());\n        }\n    }\n\n    public void checkEndToken() {\n        Token token = this.nextToken();\n        if (token == null) {\n            throw new OracleConnectionStringException(\"parse error. token is null. Expected token=')\");","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/plugins/oracle-jdbc/src/main/java/com/navercorp/pinpoint/plugin/jdbc/oracle/parser/OracleNetConnectionDescriptorTokenizer.java#L169-L205","documentation":"checkStartToken() verifies that the first token of the descriptor is '(' (the singleton TOKEN_KEY_START_OBJECT). When some other token arrives first it throws 'syntax error. Expected token='(' :<token>', including the actual token text. The URL after the '@' prefix must begin a parenthesized key-value tree.","triggerScenarios":"A driver URL whose post-'@' section starts with a literal or other token instead of '(' — e.g. jdbc:oracle:thin:@host:1521:SID routed through the descriptor parser, or '( DESCRIPTION' style stray characters before the paren.","commonSituations":"Using the easy-connect (host:port/service) form while the descriptor parser is invoked; extra text or whitespace tokens before '('; mixing TNS alias names ('@ORCL') into a parser expecting a full descriptor.","solutions":["Start the URL after '@' with '(' — use the full (DESCRIPTION=...) form for descriptor parsing","If you have a TNS alias or host:port:SID, don't route it through the descriptor parser; use the matching URL form instead","Strip any characters between '@' and the first '('","Validate the URL shape before parsing: everything after '@' should start with '(' when a descriptor is intended"],"exampleFix":"// before\nString url = \"jdbc:oracle:thin:@ORCL\"; // TNS alias, not a descriptor\n// after\nString url = \"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))\";","handlingStrategy":"validation","validationCode":"boolean descriptorStartsWithParen(String url) {\n    if (url == null) return false;\n    int at = url.indexOf('@');\n    return at != -1 && url.substring(at + 1).trim().startsWith(\"(\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(url);\n} catch (OracleConnectionStringException e) {\n    log.error(\"Oracle descriptor must start with '(' after '@': {}\", url, e);\n    throw new ConfigurationException(\"Expected '(' at descriptor start\", e);\n}","preventionTips":["Use full (DESCRIPTION=...) descriptors with this parser; keep TNS aliases and easy-connect strings on their own URL forms","Strip whitespace/text between '@' and the first '('","Decide up front which URL style you use and route each through the matching parser"],"tags":["jdbc","oracle","url-parsing","syntax"],"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-14T05:17:10.506Z"}