{"record":{"id":"e265b35b51d665a0","repo":"charmbracelet/crush","slug":"session-not-found-s-e265b3","errorCode":null,"errorMessage":"session not found: %s","messagePattern":"session not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/root.go","lineNumber":961,"sourceCode":"\t\treturn sess, nil\n\t}\n\n\tsessions, err := ws.ListSessions(ctx)\n\tif err != nil {\n\t\treturn session.Session{}, err\n\t}\n\n\tvar matches []session.Session\n\tfor _, s := range sessions {\n\t\thash := session.HashID(s.ID)\n\t\tif hash == id || strings.HasPrefix(hash, id) {\n\t\t\tmatches = append(matches, s)\n\t\t}\n\t}\n\n\tswitch len(matches) {\n\tcase 0:\n\t\treturn session.Session{}, fmt.Errorf(\"session not found: %s\", id)\n\tcase 1:\n\t\treturn matches[0], nil\n\tdefault:\n\t\treturn session.Session{}, fmt.Errorf(\"session ID %q is ambiguous (%d matches)\", id, len(matches))\n\t}\n}\n\nfunc ResolveCwd(cmd *cobra.Command) (string, error) {\n\tcwd, _ := cmd.Flags().GetString(\"cwd\")\n\tif cwd != \"\" {\n\t\terr := os.Chdir(cwd)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to change directory: %v\", err)\n\t\t}\n\t\treturn cwd, nil\n\t}\n\tcwd, err := os.Getwd()\n\tif err != nil {","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/root.go#L943-L979","documentation":"Returned by resolveWorkspaceSessionID when no stored session matches the given ID (full ID or unique prefix). The function collects workspace sessions whose ID or prefix equals the input; zero matches means the session does not exist in this workspace's database.","triggerScenarios":"Passing a session ID that was deleted, belongs to a different workspace/project directory, or contains a typo; using a session from an old .crush directory after it was recreated.","commonSituations":"Switching projects and reusing a remembered session ID; cleaning .crush data directories; resuming sessions from another machine; pasted IDs with extra whitespace or wrong case.","solutions":["Run `crush sessions` (or list in the TUI) to see valid IDs for this workspace","Verify you are in the same project directory whose .crush DB holds the session","Check the ID for typos, whitespace, or case mismatches","If the session is gone, start a new session instead of resuming"],"exampleFix":"// before: resuming with a hand-copied ID\ncrush run -s abc123de \"fix the bug\"\n// after: resolve the ID from the sessions list first\ncrush sessions   # find the correct full ID\ncrush run -s abc123de-4f5e-6789 \"fix the bug\"","handlingStrategy":"validation","validationCode":"sessions := listWorkspaceSessions() // from `crush sessions`\nif len(filterByPrefix(sessions, id)) == 0 {\n\treturn fmt.Errorf(\"session %s does not exist in this workspace\", id)\n}","typeGuard":null,"tryCatchPattern":"sess, err := resolveWorkspaceSessionID(id)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"session not found\") {\n\t\tslog.Error(\"Unknown session ID; run 'crush sessions' to list valid IDs\", \"id\", id)\n\t}\n\treturn err\n}","preventionTips":["Copy session IDs from `crush sessions` output, never from memory","Run commands from the same project directory that owns the session","Don't clean .crush directories while sessions are active","Validate IDs exist in scripts before resuming"],"tags":["session","lookup","cli"],"backgroundTag":"resource-not-found","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}