Pulumi StackReference "unknown stack output" in CI
A stack that reads another stack’s outputs via StackReference could not resolve them - the referenced stack name is wrong, lives in a backend the runner cannot see, or never exported the key being read.
What this error means
pulumi up on the consuming stack fails resolving a StackReference, reporting an unknown stack or an undefined output. It is deterministic: the same reference name and key fail every run until the producer exports the value or the name is corrected.
error: unknown stack 'myorg/network/dev' referenced by StackReference
# or
error: stack 'myorg/network/dev' does not have an output named "vpcId"Common causes
Wrong reference name or backend
The StackReference name must be the fully qualified org/project/stack, and the runner must be logged into the same backend that holds it. A short name or a different backend resolves to "unknown stack".
Producer never exported the output
The consuming stack reads getOutput("vpcId"), but the producing stack did not export const vpcId = ... (or used a different key), so there is nothing to read.
How to fix it
Reference the fully qualified stack and export the key
Export the value in the producer and reference it by its full name in the consumer.
// producer stack
export const vpcId = vpc.id;
// consumer stack
const net = new pulumi.StackReference("myorg/network/dev");
const vpcId = net.getOutput("vpcId");Confirm the backend and available outputs
- Log into the same backend (
pulumi login) the referenced stack lives in. - List what the producer exports:
pulumi stack output --stack myorg/network/dev. - Match the key name exactly - output keys are case-sensitive.
How to prevent it
- Always reference stacks by their fully qualified
org/project/stackname. - Keep producer exports and consumer
getOutputkeys in sync. - Ensure CI logs into the backend that holds every referenced stack.