Skip to content

Conversation

@catalinaperalta
Copy link
Member

@catalinaperalta catalinaperalta commented Jan 6, 2026

Fixes #13413

This happens when there is a valid commit, but that commit doesn't contain the typespec project, so the entire sparse checkout process including the commit checkout pass, but when tsp-client attempts to look for the typespec project directory it doesnt exist for that specific commit. Users would have to verify that they configured the right project directory and commit in tsp-location.yaml.

@catalinaperalta catalinaperalta marked this pull request as ready for review January 31, 2026 02:00
Copilot AI review requested due to automatic review settings January 31, 2026 02:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves error handling and messaging when the TypeSpec project directory doesn't exist in a cloned repository at a specified commit. Previously, users would see a confusing raw ENOENT error; now they receive clear guidance about verifying their tsp-location.yaml configuration.

Changes:

  • Enhanced error messages in git operations to provide clearer context when git commands fail
  • Added validation to check if the TypeSpec project directory exists after cloning and checkout, with a helpful error message directing users to verify their configuration

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tools/tsp-client/src/git.ts Wrapped git operation errors with descriptive messages for getRepoRoot, cloneRepo, and checkoutCommit functions
tools/tsp-client/src/commands.ts Added validation using stat to check if the cloned TypeSpec project directory exists, with a user-friendly error message and cleanup on failure
Comments suppressed due to low confidence (1)

tools/tsp-client/src/commands.ts:398

  • The validation added for the main TypeSpec project directory should also be applied to additional directories. After checking out the commit, the code copies additional directories from the cloned repository (lines 393-398), but doesn't verify they exist first. This could result in the same confusing ENOENT error that this PR aims to fix, but for additional directories instead of the main project directory. Consider adding similar existence checks for each additional directory before attempting to copy them.
    for (const dir of tspLocation.additionalDirectories!) {
      Logger.info(`Syncing additional directory: ${dir}`);
      await cp(joinPaths(cloneDir, dir), joinPaths(tempRoot, getAdditionalDirectoryName(dir)), {
        recursive: true,
      });
    }

@catalinaperalta
Copy link
Member Author

/check-enforcer evaluate

@catalinaperalta catalinaperalta merged commit b3dc03a into main Feb 7, 2026
13 checks passed
@catalinaperalta catalinaperalta deleted the tsp-client/fix-13413 branch February 7, 2026 01:13
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.

If Tsp-Client can't clone, the error message is complex to read.

3 participants