sundowndev/phoneinfoga · error

panic occurred while running scan, see debug logs

Error message

panic occurred while running scan, see debug logs

What it means

remote.go wraps each scanner in a recover() guard inside its goroutine; if a scanner panics (nil dereference, index out of range, etc.), the panic is converted into the collected error 'panic occurred while running scan, see debug logs' attributed to that scanner. The real panic value and stack details are only logged at debug level.

Source

Thrown at lib/remote/remote.go:68

}

func (r *Library) addError(k string, err error) {
	r.m.Lock()
	defer r.m.Unlock()
	r.errors[k] = err
}

func (r *Library) Scan(n *number.Number, opts ScannerOptions) (map[string]interface{}, map[string]error) {
	var wg sync.WaitGroup

	for _, s := range r.scanners {
		wg.Add(1)
		go func(s Scanner) {
			defer wg.Done()
			defer func() {
				if err := recover(); err != nil {
					logrus.WithField("scanner", s.Name()).WithField("error", err).Debug("Scanner panicked")
					r.addError(s.Name(), errors.New("panic occurred while running scan, see debug logs"))
				}
			}()

			if err := s.DryRun(*n, opts); err != nil {
				logrus.
					WithField("scanner", s.Name()).
					WithField("reason", err.Error()).
					Debug("Scanner was ignored because it should not run")
				return
			}

			data, err := s.Run(*n, opts)
			if err != nil {
				r.addError(s.Name(), err)
				return
			}
			if data != nil {
				r.addResult(s.Name(), data)

View on GitHub (pinned to 55807b05b7)

Solutions

  1. Re-run with debug logging enabled (--debug / logrus debug level) to see which scanner panicked and the panic value
  2. Update the library and its suppliers to the latest version — the panic may already be fixed
  3. Isolate by disabling scanners one at a time to find the faulty one
  4. If it is a custom/new scanner, add nil checks on API responses before use
  5. Report the panic (with the debug log) to the maintainers

Example fix

// before
scan --number +14155552671   # 'panic occurred while running scan'
// after
scan --number +14155552671 --debug   # reveals e.g. scanner=ovh, error="runtime error: index out of range"
Defensive patterns

Strategy: try-catch

Try / catch

// the library already recovers; treat this like a scanner failure and inspect debug logs
errs := result.Errors()
for _, e := range errs {
    if strings.Contains(e.Error(), "panic occurred while running scan") {
        log.Warnf("scanner %s panicked; rerun with debug logging", e.Scanner)
    }
}

Prevention

When it happens

Trigger: Any scanner's DryRun or Run panics at runtime — e.g. nil pointer inside a supplier client, unexpected response shape causing an index/range panic, or a nil interface in a third-party dependency.

Common situations: Hitting an upstream API that returns an unexpected payload the scanner code assumes is well-formed, a bug in a custom scanner, or a dependency regression after an upgrade.


AI-assisted analysis of sundowndev/phoneinfoga@55807b05b7 (2026-09-03). Data as JSON: /api/errors/8c4054426fdd06a6. Report an issue: GitHub.