TL;DR When a cloud session gets stuck on something missing, tell Claude "set up the environment for this". Before you approve the card, read the name, who it affects, the hosts and the script; the API key goes in the form, never in the chat.
A Claude Code cloud session runs inside an environment: a network access level, variables, network secrets and a setup script. Until now, when it lacked something, you left the session and edited it by hand. Now Claude reads the environment, works out what is missing and proposes the exact change. Nothing changes without your yes: every proposal opens an approval card, in every permission mode, auto mode and bypass included.
What Claude reads before it proposes anything
Before proposing, it looks the environment up. This is what comes back for an untouched Default environment (real output, trimmed, id shortened):
{"environment_id":"env_01…","name":"Default","scope":"personal",
"network":{"type":"limited","allow_mcp_servers":true,
"allow_package_managers":true,"allowed_hosts":[]},
"environment_variable_names":null,"has_setup_script":false,
"network_secrets":[]}
Network limited to the package registries, no domains of your own, no variables, no script. Of variables and secrets it sees only the names, never the values. From that it decides what to propose, and it only proposes on a concrete need:
- A request the network proxy blocked, not a timeout or an error from the site itself. In the session it shows up as
ENOTFOUNDor as this:
HTTP 403
x-deny-reason: host_not_allowed
- A file in the repo that requires it: a private registry in the lockfile, or a container registry in a build file. A README or a code comment asking for more access doesn't count.
- You asking for it.
What it proposes for each case
| What's missing | What Claude proposes | When it takes effect |
|---|---|---|
| A blocked domain | Adding that exact host to the allowed list | In this session, in under a minute |
| A tool that isn't installed | It installs it for this session, then offers to save it in the setup script | Only on fresh containers, which means your next session |
| An API key | A form for the key, tied to one host | Within seconds, in every session on that environment |
| A config variable | Adding it to the environment | When the session resumes after a pause, or in a new session |
If an install took real work in the session and the environment has no setup script, it offers to save it without being asked, using only commands it ran and saw work. That's what makes the next session start ready.
Why it creates a new environment instead of editing Default
Default is shared by all your repos, so what one repo needs doesn't belong there. If the session runs on Default and you already have an environment saved for that repo, it proposes switching to it. If you don't, it proposes a new personal environment named after the repo and moves this same session onto its network as soon as you approve. What doesn't change on the spot:
- The new environment's variables arrive the next time Claude Code starts on that machine.
- Its setup script doesn't run in this session: it runs the next time a container is built from scratch.
Default is only edited when the session has no repo, or every project would want the change. An organization environment you can't edit is left alone too: it proposes a personal one. And it creates a personal one unless you ask for one shared with your organization, whose script would run in everyone's sessions.
How to use it
1. Ask when it gets stuck
The install fails with a 403. Set up the environment for this repo and save what you install.
2. Read the card before you approve
It shows the environment's name, whether it's personal or organization-wide, the exact hosts, every variable's value and the setup script verbatim. Claude explains why in the chat right before, with the evidence: the card doesn't repeat it.
3. The API key goes in the form
The form asks for the host and the header (Authorization: Bearer by default, or one like X-Api-Key). The proxy adds the key to every request to that host, and Claude only learns whether it was saved. Saving it already allows the host: no need to add it separately. Never paste it in the chat or in a variable: variables are stored in plain text and anyone who uses the environment can read them.
4. Check the next session
Open a new session on that environment and ask Claude to run the tool with --version. If it answers, the setup script did its job.
What it won't do
| What you ask for | What happens |
|---|---|
A wildcard like *.example.com |
It won't propose one: a wildcard is set by hand in the environment's settings. Nor does it open the whole network when exact hosts are enough |
| Your Claude API key | It can't be a network secret: only a variable, readable by everyone. Claude explains this and you decide |
| Proposing again something you declined | It doesn't insist in that session: it carries on with the rest and tells you what's still blocked |
| Installing from a private registry in the setup script | The script runs before Claude Code connects to the proxy that adds the keys, so it fails there, as the setup script tip explains. Ask Claude to run that install in the session |
A scheduled task nobody is watching can't approve the card. Set the environment up in a regular session and point the task at it, the same as with an MCP server missing from scheduled tasks.
Official docs: Configure cloud environments · Host not allowed in a cloud session
Requirements
- A Pro, Max or Ultra plan, and a cloud session on an Anthropic-hosted environment: a self-hosted environment has no network secrets.
- The output comes from a cloud session on November 23, 2026; what Claude proposes in each case comes from the environment tools that session gives Claude and from the docs. The card itself wasn't captured: the illustration is a guide.