Buildkite "pipeline.yml could not be parsed" (Invalid YAML) in CI
Buildkite reads your pipeline definition as YAML before running anything. If the YAML is malformed, parsing fails and the build stops with a parse error and a line number.
What this error means
The build fails at the upload step with "Failed to parse pipeline.yml" or "Invalid YAML" and a line/column pointing at the offending syntax.
+++ Uploading pipeline
Error: Failed to parse pipeline.yml: found character that cannot start any token
at line 7, column 3Common causes
Tabs or bad indentation
YAML forbids tabs for indentation; a stray tab or misaligned list item makes the parser reject the file.
Unquoted special characters
A value beginning with {, [, *, : or containing a colon needs quoting; unquoted, it produces "cannot start any token" or a mapping error.
How to fix it
Lint the pipeline YAML before uploading
- Run a YAML linter or
buildkite-agent pipeline upload --dry-runon the file. - Replace tabs with spaces and quote any value with special characters.
- Commit the fix and re-run the build.
buildkite-agent pipeline upload .buildkite/pipeline.yml --dry-runQuote risky command strings
Wrap commands that contain colons or leading special characters in quotes so YAML treats them as scalars.
steps:
- command: "echo 'deploy: starting'"
label: ":rocket: deploy"How to prevent it
- Run
pipeline upload --dry-runor a YAML linter in a pre-commit hook. - Use spaces, never tabs, for YAML indentation.
- Quote command strings that contain colons or special characters.