{"record":{"id":"bf7caccd7ebe8599","repo":"pulumi/pulumi","slug":"no-snapshot-found","errorCode":null,"errorMessage":"no snapshot found","messagePattern":"no snapshot found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/state/io.go","lineNumber":344,"sourceCode":"\t\ts, err := cmdStack.RequireStack(\n\t\t\tctx,\n\t\t\tsink,\n\t\t\tws,\n\t\t\tlm,\n\t\t\tstackName,\n\t\t\tcmdStack.LoadOnly,\n\t\t\topts,\n\t\t\t\"\",\n\t\t)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t*snap, err = s.Snapshot(ctx, secrets.DefaultProvider)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif *snap == nil {\n\t\t\treturn \"\", errors.New(\"no snapshot found\")\n\t\t}\n\t}\n\turnList := make([]string, len((*snap).Resources))\n\tfor i, r := range (*snap).Resources {\n\t\turnList[i] = string(r.URN)\n\t}\n\tvar urn string\n\terr := survey.AskOne(&survey.Select{\n\t\tMessage: prompt,\n\t\tOptions: urnList,\n\t}, &urn, survey.WithValidator(survey.Required), ui.SurveyIcons(cmdutil.GetGlobalColorization()))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresult := resource.URN(urn)\n\tcontract.Assertf(result.IsValid(),\n\t\t\"Because we chose from an existing URN, it must be valid\")\n\treturn result, nil","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/state/io.go#L326-L362","documentation":"listResources' snapshot loader returns this when the current stack's Snapshot() yields nil — i.e. the backend reports no snapshot at all for the stack. State commands have nothing to enumerate or search, so they abort with 'no snapshot found'.","triggerScenarios":"Running `pulumi state` commands against a stack that has never been deployed (empty state), or a backend whose checkpoint for the stack is missing/blank.","commonSituations":"Selecting a freshly created but never-updated stack (`pulumi stack init` then `pulumi state delete ...`); pointing at the wrong project/stack; backend storage corruption losing the checkpoint.","solutions":["Confirm the stack has resources: run `pulumi stack` or `pulumi stack export` first","Deploy once (`pulumi up`) so a snapshot exists before state operations","Check you selected the intended stack (`pulumi stack ls`, `pulumi stack select`)","Restore the checkpoint from backend backups if the stack should have state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure the stack has a snapshot before state operations\nif strings.TrimSpace(stackExport()) == \"\" || len(stackResources()) == 0 {\n    return errors.New(\"stack has no state; run `pulumi up` first\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never run state commands on a freshly stack init'ed stack before the first up","Confirm target stack with `pulumi stack` before operations","Keep backend checkpoints backed up in case storage is lost"],"tags":["cli","state","snapshot"],"backgroundTag":"no-snapshot-found","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}