charmbracelet/crush · error
session ID %q is ambiguous (%d matches)
Error message
session ID %q is ambiguous (%d matches)
What it means
Returned by resolveWorkspaceSessionID when the provided ID is a prefix that matches more than one session. The resolver only accepts an exact ID or an unambiguous prefix; a shared prefix is rejected to avoid resuming the wrong conversation.
Source
Thrown at internal/cmd/root.go:965
if err != nil {
return session.Session{}, err
}
var matches []session.Session
for _, s := range sessions {
hash := session.HashID(s.ID)
if hash == id || strings.HasPrefix(hash, id) {
matches = append(matches, s)
}
}
switch len(matches) {
case 0:
return session.Session{}, fmt.Errorf("session not found: %s", id)
case 1:
return matches[0], nil
default:
return session.Session{}, fmt.Errorf("session ID %q is ambiguous (%d matches)", id, len(matches))
}
}
func ResolveCwd(cmd *cobra.Command) (string, error) {
cwd, _ := cmd.Flags().GetString("cwd")
if cwd != "" {
err := os.Chdir(cwd)
if err != nil {
return "", fmt.Errorf("failed to change directory: %v", err)
}
return cwd, nil
}
cwd, err := os.Getwd()
if err != nil {
return "", fmt.Errorf("failed to get current working directory: %v", err)
}
return cwd, nil
}View on GitHub (pinned to 7944b8e522)
Solutions
- Pass the full session ID instead of a prefix
- List sessions and pick the exact one you intend to resume
- Delete or archive stale duplicate sessions to shorten unique prefixes
- Use the session title if the CLI supports resolving by name
Example fix
// before: ambiguous prefix crush run -s abc1 "continue" // after: full unambiguous ID crush run -s abc1def2-3a4b-5c6d-7e8f-90a1b2c3d4e5 "continue"
Defensive patterns
Strategy: validation
Validate before calling
matches := filterByPrefix(sessions, shortID)
if len(matches) > 1 {
return fmt.Errorf("prefix %s is ambiguous; use the full ID", shortID)
} Try / catch
sess, err := resolveWorkspaceSessionID(id)
if err != nil {
if strings.Contains(err.Error(), "ambiguous") {
slog.Error("Session prefix matches multiple sessions; pass the full ID")
}
return err
} Prevention
- Always use full UUIDs in scripts and aliases
- Avoid truncating session IDs to fixed lengths
- Prune duplicate test sessions that share prefixes
- Prefer resolving by unique session title where supported
When it happens
Trigger: Passing a short prefix like `abc1` when two session IDs both start with `abc1` (common when many sessions share a naming pattern or were created in bulk).
Common situations: Scripts that truncate session IDs to a fixed length; many sessions auto-created during testing; copy-pasting only the first characters of a UUID.
Related errors
- session ID %q is ambiguous (%d matches)
- ${sessionList} Use more characters or the full hash
- cannot continue an agent tool session: %s
- session not found: %s
- cannot continue a child session: %s
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/a8a692565f46ef6d.
Report an issue: GitHub.