Skip to content

fix(dlt): surface underlying error and hint when attaching to pipeline fails#5836

Open
nkwork9999 wants to merge 1 commit into
SQLMesh:mainfrom
nkwork9999:fix/dlt-attach-error-message
Open

fix(dlt): surface underlying error and hint when attaching to pipeline fails#5836
nkwork9999 wants to merge 1 commit into
SQLMesh:mainfrom
nkwork9999:fix/dlt-attach-error-message

Conversation

@nkwork9999

@nkwork9999 nkwork9999 commented Jun 12, 2026

Copy link
Copy Markdown

Description

Fixes #5660.

When sqlmesh init -t dlt --dlt-path <path> cannot attach to the pipeline, the underlying dlt error is swallowed and replaced with an uninformative Could not attach to pipeline <name> message.

The root cause of the confusion in #5660 is that --dlt-path must point to dlt's pipelines working directory (where pipeline state is stored, by default ~/.dlt/pipelines), not the directory containing the pipeline scripts — and both the help text and the swallowed error gave the user no way to discover that.

This PR:

  • Surfaces the original dlt exception and the directory that was searched.
  • Adds a hint to omit --dlt-path when a pipeline with the given name exists in the default pipelines working directory (the exact scenario in [bug] DLT Error: Could not attach to pipeline #5660).
  • Clarifies the --dlt-path help text, docstring, and CLI docs.

Before:

Error: Could not attach to pipeline sushi

After:

Error: Could not attach to pipeline sushi.
Searched in: ./scripts
Pipeline with `pipeline_name=sushi` and `pipelines_dir=./scripts/sushi` could not be restored: No local pipeline state found in './scripts/sushi'.
...
Hint: A pipeline named 'sushi' exists in the default pipelines working directory '/Users/nk/.dlt/pipelines'. Note that --dlt-path must point to the directory where DLT stores pipeline working state (by default ~/.dlt/pipelines), not the directory containing your pipeline scripts. Try omitting --dlt-path.

Test Plan

  • uv run --extra dev --extra web --extra slack --extra dlt --extra lsp make style
  • uv run --extra dev --extra web --extra slack --extra dlt --extra lsp pytest tests/cli/test_cli.py -q (the one failure, test_plan_very_verbose, also fails on main in my environment and is unrelated)
  • Extended the existing test_dlt_pipeline test to assert that the error reports the searched directory and the --dlt-path hint.

Checklist

  • I have run make style and fixed any issues

…e fails

When `sqlmesh init -t dlt --dlt-path <path>` could not attach to the
pipeline, the underlying dlt error was swallowed and replaced with an
uninformative message. `--dlt-path` points to dlt's pipelines working
directory (by default ~/.dlt/pipelines), not the directory containing
the pipeline scripts, which is a common source of confusion.

Now the error includes the original dlt exception, the directory that
was searched, and a hint to omit `--dlt-path` when the pipeline exists
in the default working directory. Also clarifies the `--dlt-path` help
text and docstring accordingly.

Fixes SQLMesh#5660.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] DLT Error: Could not attach to pipeline

1 participant