Skip to content

fix(apps): redeploying an app within ~90 min of deleting it fails: "endpoint template names must be unique" - #696

Open
deanq wants to merge 4 commits into
mainfrom
deanq/sls-991-deploy-template-names
Open

deanq wants to merge 4 commits into
mainfrom
deanq/sls-991-deploy-template-names

Conversation

@deanq

@deanq deanq commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

rp flash deploy named every endpoint template {app}-{resource}-template. Template names are unique per owner, and a deleted endpoint keeps its template for a while before the platform removes it. So these fail with "endpoint template names must be unique":

rp flash deploy
rp flash app delete <app> --yes
rp flash deploy        # same app name, shortly after the delete

Deploying an app to a second environment while the first one is live fails for the same reason.

Changes:

  • New endpoints get {app}-{resource}-template-<6 hex chars>.
  • Updates to existing endpoints send the bound template's current name, so redeploying a live app sends the same template name as today. The environment queries now select endpoints { id name template { name } }.
  • If an existing endpoint comes back without template info, the legacy fixed name is used.

Why this shape

Only new endpoints vary the name. Updates keep it, so this PR doesn't depend on how the platform treats a template name change during an update.

#683 fixes the same collision for rp flash dev sessions in dev.py. This PR only touches the deploy path (deploy.py and the environment queries), so the two don't overlap.

Template cleanup after an endpoint is deleted isn't part of this PR. Held templates are removed by the platform.

Test plan

  • New tests in tests/test_apps/test_deploy.py:
    • new endpoints get a suffixed name that differs between deploys
    • updates keep the existing template name
    • endpoints without template info use the legacy name
    • both environment queries select the template name
  • The suffix and keep-name tests failed before the change
  • make quality-check (2778 passed)
  • Live check: the first deploy got a suffixed template name, a redeploy kept it, and deleting the app then redeploying right away got a new suffix and succeeded. On unfixed code, the same delete-then-redeploy failed with "endpoint template names must be unique".

Template names are unique per owner, and a deleted endpoint keeps its
template for a while before the platform removes it. Deploys named
every template {app}-{resource}-template, so redeploying an app soon
after deleting it, or deploying it to a second environment, failed
with "endpoint template names must be unique".

- new endpoints get {app}-{resource}-template-<6 hex chars>
- updates send the bound template's current name, read from the
  environment query, so redeploys of existing endpoints are unchanged
- endpoints without template info fall back to the legacy name
@celine-runpod celine-runpod changed the title fix(apps): give new deployed endpoints unique template names fix(apps): give new deployed endpoints unique template names (SLS-991) Nov 9, 2026
@celine-runpod celine-runpod changed the title fix(apps): give new deployed endpoints unique template names (SLS-991) fix(apps): redeploying an app within ~90 min of deleting it fails: "endpoint template names must be unique" (SLS-991) Nov 9, 2026
@celine-runpod

Copy link
Copy Markdown
Contributor

bugbot run

@deanq deanq changed the title fix(apps): redeploying an app within ~90 min of deleting it fails: "endpoint template names must be unique" (SLS-991) fix(apps): redeploying an app within ~90 min of deleting it fails: "endpoint template names must be unique" Nov 9, 2026
@deanq
deanq requested a balanced review from Copilot November 9, 2026 18:03

Copilot AI 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.

🟢 Approval recommended

No active review issues remain for the template-naming changes.

No open issues 🎉

What changed in this PR

This PR prevents template-name collisions when redeploying a recently deleted app or deploying the same app to another environment, without changing template names for existing endpoints.

Changes:

  • Adds a random six-character hexadecimal suffix to template names for new endpoints.
  • Preserves existing endpoints’ bound template names, with a legacy-name fallback when template information is unavailable.
  • Extends environment queries and adds regression tests for naming behavior and query fields.
File Description
tests/​test_apps/​test_deploy.py Tests new-name uniqueness, existing-name preservation, fallback behavior, and query fields.
runpod/​apps/​deploy.py Generates suffixed names for new endpoints and preserves names during updates.
runpod/​api/​queries/​apps.py Fetches bound template names in both environment queries.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

4 participants