jaegertracing/jaeger · error

query exists in template without ";"

Error message

query exists in template without ";"

What it means

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.

Source

Thrown at internal/storage/v1/cassandra/schema/schema.go:112

		}

		extractedLines = append(extractedLines, trimmedLine)
	}

	var queries []string

	// Construct individual queries strings
	var queryString string
	for _, line := range extractedLines {
		queryString += string(line) + "\n"
		if bytes.HasSuffix(line, []byte(";")) {
			queries = append(queries, queryString)
			queryString = ""
		}
	}

	if queryString != "" {
		return nil, errors.New(`query exists in template without ";"`)
	}

	return queries, nil
}

func (sc *Creator) getCassandraQueriesFromQueryStrings(queries []string) []cassandra.Query {
	var casQueries []cassandra.Query

	for _, query := range queries {
		casQueries = append(casQueries, sc.session.Query(query))
	}

	return casQueries
}

func (sc *Creator) contructSchemaQueries() ([]cassandra.Query, error) {
	params := sc.constructTemplateParams()

View on GitHub (pinned to 806f444784)

Solutions

  1. Open the schema template (embedded CQL template file consumed by getQueriesFromBytes) and add a ';' after every statement, especially the last one.
  2. Re-run contructSchemaQueries or the schema tests to confirm the template now parses into the expected queries.
  3. If the template is programmatically supplied, check for trailing whitespace-stripped fragments and ensure each query ends with ';'.

Example fix

// before (template)
CREATE TABLE IF NOT EXISTS traces (...)
// after (template)
CREATE TABLE IF NOT EXISTS traces (...);
Defensive patterns

Strategy: validation

Validate before calling

// validate template before use
for _, q := range strings.Split(string(templateBytes), ";") {
    if strings.TrimSpace(q) != "" && !strings.Contains(string(templateBytes), q+";") {
        return fmt.Errorf("query %q missing terminating semicolon", strings.TrimSpace(q))
    }
}

Try / catch

queries, err := getQueriesFromBytes(schemaBytes)
if err != nil {
    return fmt.Errorf("parsing schema template: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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 ';'.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/1ea4a1380b43829c. Report an issue: GitHub.