temporalio/temporal · error

error reading contents: unmatched `BEGIN` keyword

Error message

error reading contents: unmatched `BEGIN` keyword

What it means

Error "error reading contents: unmatched `BEGIN` keyword" thrown in temporalio/temporal.

Source

Thrown at common/persistence/query_util.go:182

					if j+len(sqlLineComment) <= n && contentStr[j:j+len(sqlLineComment)] == sqlLineComment {
						_, _ = stmtBuilder.Write(bytes.TrimRight(content[i:j], " "))
						for j < n && contentStr[j] != '\n' {
							j++
						}
						i = j
					}

				default:
					// no-op: generic character
				}
			}

			if len(st) > 0 {
				switch st[len(st)-1] {
				case sqlLeftParenthesis:
					return nil, fmt.Errorf("error reading contents: unmatched left parenthesis")
				case sqlBeginKeyword[0]:
					return nil, fmt.Errorf("error reading contents: unmatched `BEGIN` keyword")
				default:
					// should never enter here
					return nil, fmt.Errorf("error reading contents: unmatched `%c`", st[len(st)-1])
				}
			}

			_, _ = stmtBuilder.Write(content[i:j])
			stmt := strings.TrimSpace(stmtBuilder.String())
			if stmt == "" {
				continue
			}
			result = append(result, stmt)
		}
	}
	return result, nil
}

// hasWordAt is a simple test to check if it matches the whole word:

View on GitHub (pinned to bde624efd1)

When it happens

Trigger: Thrown at common/persistence/query_util.go:182 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01). Data as JSON: /api/errors/a02b7649fc3bcf87. Report an issue: GitHub.