charmbracelet/crush · error

${sessionList} Use more characters or the full hash

Error message

${sessionList}
Use more characters or the full hash

What it means

resolveSessionID builds this multi-line message when a session ID prefix is ambiguous — the given string is not a full UUID and matches the hash prefix of multiple sessions. Modeled after Git's short-hash behavior, it lists each matching session (12-char hash prefix, title, creation date) and tells the caller to supply more characters or the full hash.

Source

Thrown at internal/cmd/session.go:257

	}

	if len(matches) == 1 {
		return matches[0], nil
	}

	// Ambiguous - show matches like Git does
	var sb strings.Builder
	fmt.Fprintf(&sb, "session ID '%s' is ambiguous. Matches:\n\n", id)
	for _, m := range matches {
		hash := session.HashID(m.ID)
		created := time.Unix(m.CreatedAt, 0).Format("2006-01-02")
		// Keep title on one line by replacing newlines with spaces, and truncate.
		title := strings.ReplaceAll(m.Title, "\n", " ")
		title = ansi.Truncate(title, 50, "…")
		fmt.Fprintf(&sb, "  %s... %q (created %s)\n", hash[:12], title, created)
	}
	sb.WriteString("\nUse more characters or the full hash")
	return session.Session{}, errors.New(sb.String())
}

func runSessionShow(cmd *cobra.Command, args []string) error {
	event.SetNonInteractive(true)

	ctx, svc, cleanup, err := sessionSetup(cmd)
	if err != nil {
		return err
	}
	defer cleanup()

	event.SessionShown(sessionShowJSON)

	sess, err := resolveSessionID(ctx, svc.sessions, args[0])
	if err != nil {
		return err
	}

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Repeat the command with more characters of the hash, or use the full hash/UUID shown in the match list.
  2. Pick the intended session from the printed matches (each shows a 12-char prefix, title, and creation date).
  3. Use `crush sessions` to list all sessions with their full identifiers and copy the exact one.

Example fix

// before
crush session delete a1b2
// error: session ID 'a1b2' is ambiguous...
// after
crush session delete a1b2c3d4e5f6
Defensive patterns

Strategy: validation

Validate before calling

// Validate length before invoking session commands
if len(sessionID) < 12 && !isUUID(sessionID) {
    return fmt.Errorf("provide at least 12 hash chars or the full UUID, got %q", sessionID)
}

Try / catch

if _, err := resolveSessionID(ctx, svc, id); err != nil && strings.Contains(err.Error(), "is ambiguous") {
    // list the matches from err.Error() and re-prompt for a longer prefix
}

Prevention

When it happens

Trigger: Passing a short hash prefix to crush session show/delete/rename or the run command's --session flag when two or more sessions share that prefix; e.g. two sessions whose HashIDs both start with 'a1b2'.

Common situations: Users copying only the first few characters of a session hash from a list; long-lived installs with many sessions increasing collision odds of short prefixes; scripts that truncate session IDs.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/19901745ce2006b8. Report an issue: GitHub.