node
type_error
ai_generated
true
TypeError: callback is not a function
ID: node/typeerror-callback-not-function
92%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
Callback argument is undefined. Common when using promisified API with callback style, or missing argument.
genericWorkarounds
-
95% success Check if you're mixing callback and promise APIs — use await or .then() instead
// Old: fs.readFile(path, callback) // New: const data = await fs.promises.readFile(path)
-
88% success Verify all required arguments are passed — the callback might be a missing middle argument
Verify all required arguments are passed — the callback might be a missing middle argument
Dead Ends
Common approaches that don't work:
-
Add a no-op callback: () => {}
65% fail
Hides the real issue — the function signature changed
-
Wrap in try/catch
70% fail
The error is thrown synchronously before the callback — catch won't help async flow
Error Chain
Frequently confused with: