{"record":{"id":"1ea4a1380b43829c","repo":"jaegertracing/jaeger","slug":"query-exists-in-template-without","errorCode":null,"errorMessage":"query exists in template without \";\"","messagePattern":"query exists in template without \";\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v1/cassandra/schema/schema.go","lineNumber":112,"sourceCode":"\t\t}\n\n\t\textractedLines = append(extractedLines, trimmedLine)\n\t}\n\n\tvar queries []string\n\n\t// Construct individual queries strings\n\tvar queryString string\n\tfor _, line := range extractedLines {\n\t\tqueryString += string(line) + \"\\n\"\n\t\tif bytes.HasSuffix(line, []byte(\";\")) {\n\t\t\tqueries = append(queries, queryString)\n\t\t\tqueryString = \"\"\n\t\t}\n\t}\n\n\tif queryString != \"\" {\n\t\treturn nil, errors.New(`query exists in template without \";\"`)\n\t}\n\n\treturn queries, nil\n}\n\nfunc (sc *Creator) getCassandraQueriesFromQueryStrings(queries []string) []cassandra.Query {\n\tvar casQueries []cassandra.Query\n\n\tfor _, query := range queries {\n\t\tcasQueries = append(casQueries, sc.session.Query(query))\n\t}\n\n\treturn casQueries\n}\n\nfunc (sc *Creator) contructSchemaQueries() ([]cassandra.Query, error) {\n\tparams := sc.constructTemplateParams()\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/cassandra/schema/schema.go#L94-L130","documentation":"getQueriesFromBytes parses the embedded CQL schema template into individual queries by splitting on semicolons. After the split loop, if leftover non-empty text remains (queryString != \"\"), the template contained a query that never terminated with a semicolon, so the parser raises 'query exists in template without \";\"'. It is a template-authoring error that keeps an incomplete CQL statement from being silently executed.","triggerScenarios":"Calling contructSchemaQueries (which invokes getQueriesFromBytes) when the embedded schema.cql/template bytes contain a statement missing its trailing semicolon — e.g. a new query appended to the template file without ';'. Also exercised directly by TestQueryGenerationFromBytes and TestInvalidQueryTemplate.","commonSituations":"A contributor edits the Cassandra schema template and forgets a terminating semicolon; a merge or sed-based edit truncates the last statement; custom query templates passed in tests omit the final ';'.","solutions":["Open the schema template (embedded CQL template file consumed by getQueriesFromBytes) and add a ';' after every statement, especially the last one.","Re-run contructSchemaQueries or the schema tests to confirm the template now parses into the expected queries.","If the template is programmatically supplied, check for trailing whitespace-stripped fragments and ensure each query ends with ';'."],"exampleFix":"// before (template)\nCREATE TABLE IF NOT EXISTS traces (...)\n// after (template)\nCREATE TABLE IF NOT EXISTS traces (...);","handlingStrategy":"validation","validationCode":"// validate template before use\nfor _, q := range strings.Split(string(templateBytes), \";\") {\n    if strings.TrimSpace(q) != \"\" && !strings.Contains(string(templateBytes), q+\";\") {\n        return fmt.Errorf(\"query %q missing terminating semicolon\", strings.TrimSpace(q))\n    }\n}","typeGuard":null,"tryCatchPattern":"queries, err := getQueriesFromBytes(schemaBytes)\nif err != nil {\n    return fmt.Errorf(\"parsing schema template: %w\", err)\n}","preventionTips":["End every statement in the CQL template with ';', including the last one.","Add/keep a unit test (like TestInvalidQueryTemplate) and run it after template edits."],"tags":["cassandra","schema","template-parsing","configuration"],"backgroundTag":"malformed-template-statement","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}