Skip to content

fix(cli): use template alias for migrate build name#1563

Open
Solaris-star wants to merge 1 commit into
e2b-dev:mainfrom
Solaris-star:fix/1478-migrate-use-template-alias
Open

fix(cli): use template alias for migrate build name#1563
Solaris-star wants to merge 1 commit into
e2b-dev:mainfrom
Solaris-star:fix/1478-migrate-use-template-alias

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

e2b template migrate wrote template_id into the second argument of Template.build / AsyncTemplate.build when template_name was absent. That argument is the template name (alias), not the internal ID. Rebuilding with the ID as a new alias collides with the existing template → 409 Alias already used.

Change

  • Prefer template_name / --name for the generated build scripts
  • When only template_id is present, list templates and use the first alias for that ID
  • Fall back to template_id only with a clear warning (and document --name)
  • Regression test: template_name wins over an opaque template_id in build_prod.py / build_dev.py

Test plan

  • Unit test: migrate with template_id + template_name emits the alias, not the ID
  • Manual: migrate an existing template that has an alias and run python build_prod.py without 409

Fixes #1478

migrate fell back to template_id as Template.build(..., name). That
argument is the human-readable alias, so rebuilding with the opaque ID
self-collides (409). Prefer template_name, then resolve aliases via the
templates API, and only fall back to template_id with a warning.

Fixes e2b-dev#1478
@cla-bot

cla-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @Solaris-star on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check'

@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f16290c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f16290c625

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +30 to +33
async function resolveMigrateBuildName(
config: E2BConfig,
nameOverride?: string
): Promise<string> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add a changeset for the CLI fix

The repo-root AGENTS.md says, “Generate a changeset when updating packages/cli…”, but this commit changes packages/cli source/tests without adding or updating a .changeset entry for @e2b/cli; as a result this user-facing CLI fix can be omitted from the next package version/changelog. Please add a changeset describing the migrate alias fix.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@cla-bot check

@Solaris-star

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jul 24, 2026
@cla-bot

cla-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@Solaris-star

Copy link
Copy Markdown
Author

@cla-bot check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: e2b template migrate writes template_id into the name slot of build_prod.py, causing 409 alias collision on rebuild

1 participant