plandex-ai/plandex · error

no context found with name: %s

Error message

no context found with name: %s

What it means

For non-numeric arguments, `plandex contexts show` scans the listed contexts comparing each ctx.Name and ctx.FilePath to the argument. If no context matches, it returns 'no context found with name: %s'. The lookup is exact-match against the contexts of the current plan and branch, so case differences, partial names, or contexts on other branches will not match.

Source

Thrown at app/cli/cmd/context_show.go:56

		if idx, err := strconv.Atoi(nameOrIndex); err == nil {
			// Convert to 0-based index
			idx--
			if idx < 0 || idx >= len(contexts) {
				return fmt.Errorf("invalid context index: %s", nameOrIndex)
			}
			contextId = contexts[idx].Id
		} else {
			// Try finding by name
			found := false
			for _, ctx := range contexts {
				if ctx.Name == nameOrIndex || ctx.FilePath == nameOrIndex {
					contextId = ctx.Id
					found = true
					break
				}
			}
			if !found {
				return fmt.Errorf("no context found with name: %s", nameOrIndex)
			}
		}

		res, apiErr := api.Client.GetContextBody(lib.CurrentPlanId, lib.CurrentBranch, contextId)
		if apiErr != nil {
			log.Printf("Error getting context body: %v\n", apiErr)
			return fmt.Errorf("error getting context body: %v", apiErr)
		}

		fmt.Println(res.Body)
		return nil
	},
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run `plandex contexts` to list exact names and file paths, then retry with an exactly matching name or path.
  2. Copy the FilePath exactly as shown (including './' prefix) — matching is exact, not fuzzy or case-insensitive.
  3. Check whether the context lives on another branch or plan and switch (`plandex checkout <branch>`) first.
  4. Re-load the context with `plandex load <file>` if it was removed.

Example fix

// before
plandex contexts show README.md   // fails if context path is './README.md'
// after
plandex contexts                  # shows './README.md' as the exact path
plandex contexts show ./README.md
Defensive patterns

Strategy: validation

Validate before calling

# verify the exact name/path exists before showing
plandex contexts | grep -Fx './README.md' >/dev/null && plandex contexts show ./README.md

Type guard

func findContext(contexts []shared.Context, nameOrPath string) *shared.Context {
    for i := range contexts {
        if contexts[i].Name == nameOrPath || contexts[i].FilePath == nameOrPath {
            return &contexts[i]
        }
    }
    return nil
}

Try / catch

ctx := findContext(contexts, arg)
if ctx == nil {
    names := make([]string, len(contexts))
    for i, c := range contexts { names[i] = c.Name }
    return fmt.Errorf("%q not found; available: %v", arg, names)
}

Prevention

When it happens

Trigger: Running `plandex contexts show <name>` where the argument does not exactly equal any context's Name or FilePath in the current plan/branch — e.g. typo, wrong case, a path missing its './' prefix, or a context that only exists on another branch.

Common situations: Referencing a context by a shorthand name that was never set; the context was unloaded (`plandex unstage`/`rm`) before showing it; quoting/whitespace issues in shell; running from a different plan directory than intended.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/86268d4ab583b5e4. Report an issue: GitHub.