pranshuparmar/witr · error
no matching process found
Error message
no matching process found
What it means
processTarget resolved the target (process name, pid, port, etc.) via target.Resolve and got no error but an empty pid list — the lookup succeeded syntactically yet matched nothing. The library converts the empty result into this explicit error and routes it through handleResolveError for reporting.
Source
Thrown at internal/app/app.go:417
return string(data)
}
// processTarget handles resolving and rendering a single target.
// Returns the exit code for this target.
func processTarget(cmd *cobra.Command, outw io.Writer, outp output.Printer, t model.Target, flags appFlags, multiMode bool, jsonResults *[]string) int {
colorEnabled := useColor(flags, outw)
if flags.env {
return processEnvTarget(outw, outp, t, flags, multiMode, jsonResults)
}
if t.Type == model.TargetContainer {
return processContainerTarget(cmd, outw, outp, t, flags, multiMode, jsonResults)
}
pids, err := target.Resolve(t, flags.exact)
if err == nil && len(pids) == 0 {
err = fmt.Errorf("no matching process found")
}
if err != nil {
return handleResolveError(cmd, outw, outp, t, err, flags, multiMode, jsonResults)
}
if len(pids) > 1 {
if multiMode && flags.json {
*jsonResults = append(*jsonResults, jsonErrorEntry(t, fmt.Sprintf("multiple processes matched (%d results)", len(pids))))
} else {
hint := "witr --pid <pid>"
if flags.env {
hint = "witr --pid <pid> --env"
}
printMultiMatch(outp, pids, colorEnabled, hint)
}
return ExitInvalidInput
}
View on GitHub (pinned to dc4fa1da82)
Solutions
- Verify the process exists: run `ps aux | grep <name>` or `lsof -i :<port>` before invoking.
- Check the pid is current — the target may have exited; re-resolve it.
- Drop --exact or use the full process name if exact matching filtered out your target.
- Confirm user permissions: processes owned by other users may be hidden; retry with sudo.
Example fix
// before
cmd := exec.Command("errlookup", "myapp") // crashes: no match after restart
// after
if out, err := exec.Command("pgrep", "-x", "myapp").Output(); err != nil || len(out) == 0 {
return fmt.Errorf("myapp is not running; start it before inspecting")
}
cmd := exec.Command("errlookup", "myapp") Defensive patterns
Strategy: validation
Validate before calling
func processExists(name string) bool {
out, err := exec.Command("pgrep", "-f", name).Output()
return err == nil && len(strings.Fields(string(out))) > 0
}
if !processExists("myapp") {
return errors.New("myapp is not running; nothing to inspect")
} Try / catch
err := runLookup(target)
if err != nil && strings.Contains(err.Error(), "no matching process found") {
log.Printf("target %q matched no process; skipping", target.Value)
return nil
}
if err != nil { return err } Prevention
- Confirm the process/port exists with ps/lsof before lookup.
- Re-resolve pids at run time instead of caching them across restarts.
- Avoid --exact unless you pass the full, case-correct process name.
- Run with sufficient privileges (same user or sudo) to see all processes.
When it happens
Trigger: A process-name target that matches no running process; a --pid whose process has exited; a --port with no listening socket; --exact matching where the name differs in case or suffix.
Common situations: Typos in process names; service already stopped/crashed; checking a port after the app moved to another port; using the exact flag with a truncated or case-mismatched name.
Related errors
- no container found matching %q
- must specify --pid, --port, --file, --container, or a proces
- completed with exit code %d
- no process ancestry found
AI-assisted analysis of pranshuparmar/witr@dc4fa1da82 (2026-09-01).
Data as JSON: /api/errors/570493a7a51e457e.
Report an issue: GitHub.