shadow1ng/fscan · error

Kind of Value for listener is not Func.

Error message

Kind of Value for listener is not Func.

What it means

ErrNoneFunction: emitted (or panicked, when no RecoveryListener is set) when a value registered via Emitter.On is not a reflect.Func — i.e. the caller passed something other than a function as the event listener.

Source

Thrown at libs/grdp/emission/emitter.go:19

// Package emission provides an event emitter.
// copy form https://raw.githubusercontent.com/chuckpreslar/emission/master/emitter.go
// fix issue with nest once

package emission

import (
	"errors"
	"fmt"
	"os"
	"reflect"
	"sync"
)

// Default number of maximum listeners for an event.
const DefaultMaxListeners = 10

// Error presented when an invalid argument is provided as a listener function
var ErrNoneFunction = errors.New("Kind of Value for listener is not Func.")

// RecoveryListener ...
type RecoveryListener func(interface{}, interface{}, error)

// Emitter ...
type Emitter struct {
	// Mutex to prevent race conditions within the Emitter.
	*sync.Mutex
	// Map of event to a slice of listener function's reflect Values.
	events map[interface{}][]reflect.Value
	// Optional RecoveryListener to call when a panic occurs.
	recoverer RecoveryListener
	// Maximum listeners for debugging potential memory leaks.
	maxListeners int

	// Map of event to a slice of listener function's reflect Values.
	onces map[interface{}][]reflect.Value
}

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Pass a function value to On()/Once(), not a method result or variable of another type
  2. Register a RecoveryListener on the Emitter to convert the panic into recoverable handling
  3. Add a compile-time check or test asserting listeners are funcs
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at libs/grdp/emission/emitter.go:19 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/192c974ba1122580. Report an issue: GitHub.