{"record":{"id":"831054d2630a5e88","repo":"temporalio/temporal","slug":"error-reading-contents-w","errorCode":null,"errorMessage":"error reading contents: %w","messagePattern":"error reading contents: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/persistence/query_util.go","lineNumber":63,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error opening file %s: %w\", filePath, err)\n\t\t}\n\t\tfiles = append(files, f)\n\t}\n\n\treturn LoadAndSplitQueryFromReaders(files)\n}\n\n// LoadAndSplitQueryFromReaders loads and split cql / sql query into one statement per string.\n// Comments are removed from the query.\nfunc LoadAndSplitQueryFromReaders(\n\treaders []io.Reader,\n) ([]string, error) {\n\tresult := make([]string, 0, querySliceDefaultSize)\n\tfor _, r := range readers {\n\t\tcontent, err := io.ReadAll(r)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading contents: %w\", err)\n\t\t}\n\t\tn := len(content)\n\t\tcontentStr := string(bytes.ToLower(content))\n\t\tfor i, j := 0, 0; i < n; i = j {\n\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:","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/query_util.go#L45-L81","documentation":"Error \"error reading contents: %w\" thrown in temporalio/temporal.","triggerScenarios":"Thrown at common/persistence/query_util.go:63 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"}