{"record":{"id":"fc3680b29c33e528","repo":"temporalio/temporal","slug":"error-reading-contents-unmatched-right-parenthesi","errorCode":null,"errorMessage":"error reading contents: unmatched right parenthesis","messagePattern":"error reading contents: unmatched right parenthesis","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/query_util.go","lineNumber":86,"sourceCode":"\t\t\t// stack to keep track of open parenthesis/blocks\n\t\t\tvar st []byte\n\t\t\tvar stmtBuilder strings.Builder\n\n\t\tstmtLoop:\n\t\t\tfor ; j < n; j++ {\n\t\t\t\tswitch contentStr[j] {\n\t\t\t\tcase queryDelimiter:\n\t\t\t\t\tif len(st) == 0 {\n\t\t\t\t\t\tj++\n\t\t\t\t\t\tbreak stmtLoop\n\t\t\t\t\t}\n\n\t\t\t\tcase sqlLeftParenthesis:\n\t\t\t\t\tst = append(st, sqlLeftParenthesis)\n\n\t\t\t\tcase sqlRightParenthesis:\n\t\t\t\t\tif len(st) == 0 || st[len(st)-1] != sqlLeftParenthesis {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"error reading contents: unmatched right parenthesis\")\n\t\t\t\t\t}\n\t\t\t\t\tst = st[:len(st)-1]\n\n\t\t\t\tcase sqlDoubleDollarKeyword[0]:\n\t\t\t\t\tif !hasWordAt(contentStr, sqlDoubleDollarKeyword, j) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif len(st) == 0 || st[len(st)-1] != sqlDoubleDollarKeyword[0] {\n\t\t\t\t\t\tst = append(st, sqlDoubleDollarKeyword[0])\n\t\t\t\t\t\tj += len(sqlDoubleDollarKeyword) - 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tst = st[:len(st)-1]\n\t\t\t\t\t\tj += len(sqlDoubleDollarKeyword) - 1\n\t\t\t\t\t}\n\n\t\t\t\tcase sqlIfKeyword[0]:\n\t\t\t\t\tif !hasWordAt(contentStr, sqlIfKeyword, j) {\n\t\t\t\t\t\tcontinue","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/query_util.go#L68-L104","documentation":"Error \"error reading contents: unmatched right parenthesis\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at common/persistence/query_util.go:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}