---
title: "Edit a codebase's secrets"
description: "Add, replace or remove the environment variables your app needs, with every change tested on a fresh environment before it is saved."
url: https://help.modeinspect.com/en/articles/12-edit-a-codebase-s-secrets
collection: "Set up your codebase"
updated: 2026-10-28
language: en
---

# Edit a codebase's secrets

Add, replace or remove the environment variables your app needs, with every change tested on a fresh environment before it is saved.

Change the environment variables your app runs with after setup, for example when an engineer rotates an API key. Every change is tried on a fresh test environment first, so a value that breaks the app is never saved.

**Before you start**

-   A connected codebase that finished setup. See [What happens during setup](https://help.modeinspect.com/en/articles/17-what-happens-during-setup.md).
    

## Steps

1.  Open the codebase from **CODEBASES** in the sidebar and click the **…** button next to its name.
    
    ![The codebase page with the menu next to the codebase name open: Rename codebase, Edit secrets, Edit start scripts, Edit Design Guidelines, Edit memories and Delete Codebase](https://staticfiles.gleap.io/p6a1872808f187689a3937fa3/geN0ahpXH6mkE5dADelgbGqfj0NDmTqQBxxAPNWZ0OG1ywZhkd2xbzla9538LI6m5o1WyzFBjDe.png)
2.  Click **Edit secrets**. The dialog lists **Environment variables** with the saved values masked.
    
3.  Click **Add variable** and type the name and value. To add many at once, click **Paste .env**, paste the lines, and click **Add variables**. To change a saved value, click the pencil next to it. To remove one, click the cross.
    
    ![The Edit secrets dialog with one saved variable, a new variable being typed and the Update button](https://staticfiles.gleap.io/p6a1872808f187689a3937fa3/zWhMfA0vyzqmQ35KcOUaACAo9NtOWsh32mI5VOZcLEdfvucyetlv2xjA5PS89fV5c3NpvWINWTM.png)
4.  Click **Update**. The panel **Verifying on a fresh sandbox** appears while your setup replays with the new values. This usually takes a minute or two, and the dialog stays locked until it finishes.
    

When the run passes, the dialog closes and the toast **Setup config saved** confirms it. New canvases start with the new values. A canvas that is already open keeps running with the old ones until its environment starts again.

When the run fails, the dialog shows **Verification failed** with the step that broke and its output. Nothing was saved. Fix the value and click **Update** again, or click **Revert changes** to go back to the saved configuration.

![The Edit secrets dialog after a failed run: Verification failed, the Install dependencies step with its error output, and the Revert changes button](https://staticfiles.gleap.io/p6a1872808f187689a3937fa3/YZVRVnZ8TOljrlSvxHhNXWMIC6VyF9Z2u0piMyxfiQPqMQdiV9k3tJyXKWtVxu5cwGXaWYhQNnl.png)

The same menu has **Rename codebase**, which changes the name you see in the sidebar, and **Delete Codebase**, which deletes the codebase permanently after a confirmation.

## If it does not work

-   **A pasted line was skipped**: lines without `=`, lines without a name, and values that reference another variable with `$` are listed under the paste box with the reason. Add those by hand with **Add variable**.
    
-   **Add variable is disabled**: a codebase holds up to 100 variables. The counter next to **Environment variables** shows how many you have.
    
-   **"Another verification is still running for this codebase"**: one run at a time per codebase. Wait for it to finish, or close and reopen the dialog to pick it up.
    
-   **Verification runs past five minutes**: a **Cancel** button appears in the verifying panel after two minutes. The run is also stopped automatically at five, with **Verification couldn't finish**. Check the value and try again.
    

## Related

-   [Add start scripts to a codebase](https://help.modeinspect.com/en/articles/13-edit-start-scripts.md)
    
-   [Write design guidelines for the agent](https://help.modeinspect.com/en/articles/18-write-design-guidelines.md)
    
-   [Review and verify the setup config](https://help.modeinspect.com/en/articles/14-review-and-verify-the-setup-config.md)

## Related

- [Connect a GitHub repository](https://help.modeinspect.com/en/articles/11-connect-a-github-repository.md)
- [Upload a codebase as a zip](https://help.modeinspect.com/en/articles/16-upload-a-codebase-as-a-zip.md)
- [Start from a blank codebase](https://help.modeinspect.com/en/articles/15-start-from-a-blank-codebase.md)
- [What happens during setup](https://help.modeinspect.com/en/articles/17-what-happens-during-setup.md)
- [Answer Auto-setup's questions](https://help.modeinspect.com/en/articles/10-answer-auto-setup-s-questions.md)
