Repository navigation
feat(cli): explain construct errors caused by two checkly installs [RED-1240] [ship] - #1564
Merged
Merged
Conversation
sorccu
force-pushed
the
simo/red-1240-explain-two-checkly-copies
branch
from
October 25, 2026 03:26
4b90a67 to
975fe66
Compare
…ED-1240] "Unable to create a construct ... outside a Checkly CLI project" also happens when the project's files import a different checkly install than the one running the command, which the hand-off to the project's install cannot always prevent: an older global CLI, CHECKLY_NO_DELEGATION=1, a project install that cannot be used, or Deno. The error now names both installs, says constructs only register with the install that runs the command, and suggests what to do. Either install may be the older one, so both explain it: the construct's copy when the running CLI (process.argv[1]) belongs to another install, and the running CLI when loading a file fails with another install's error. The explanation is given once, without the other install's stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… [RED-1240] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sorccu
force-pushed
the
simo/red-1240-explain-two-checkly-copies
branch
from
October 25, 2026 15:31
975fe66 to
6987cf7
Compare
sorccu
enabled auto-merge (squash)
October 25, 2026 15:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: RED-1240
Problem
Unable to create a construct '<X>' outside a Checkly CLI project.also happens when the project's files import a differentchecklyinstall than the one running the command. Constructs then register with aSessionthe running CLI never reads. #1563 hands commands to the project's install to prevent this, but that doesn't help in four cases:CHECKLY_NO_DELEGATION=1;In those cases the bare message gives no hint of the real cause.
Change
In that case the error keeps its first line and adds an explanation. It names both installs (version and path), says constructs only register with the install that runs the command, and suggests what to do:
The advice depends on the case:
CHECKLY_NO_DELEGATION=1is set on a CLI that can hand off: say so.npx checklyfails too.npx.Either install can be the older one, so both sides detect it (
src/services/two-installs.ts):Session.validateCreateConstruct) explains it whenprocess.argv[1]belongs to another checkly package. This covers an old global CLI running a new project install, because all older CLIs embed the thrown message.Session.loadFile) explains it when a file fails with that message from another install. That means an error that isn't its ownOutsideProjectError, where the file resolves a differentnode_modules/checkly. This covers a new CLI running an old project install. The project's install is looked up from the config directory, as the hand-off does.The explanation appears once. When the running CLI reports it, it throws without the other install's stack or a cause, because oclif prints the cause chain. Diagnosis runs only on the error path, is synchronous, and never throws: anything unexpected keeps today's message.
Also:
isSameDirectoryinproject-cli.tsis now synchronous and shared, and the dev-build version check (isDevelopmentBuild) is shared withbaseCommand.ts.Testing
src/services/__tests__/two-installs.spec.ts:Session;session.tsreverted, the Session tests fail.checkly@9.5.0running a project with this build: explained, including the update advice;CHECKLY_NO_DELEGATION=1running a project withcheckly@9.5.0: explained once, including the opt-out sentence.process.argv[1]) underdeno run npm:checkly.🤖 Generated with Claude Code