{"record":{"id":"edcd022c9756fbc7","repo":"oxc-project/oxc","slug":"react-hook-hook-name-received-a-function-whose-d","errorCode":null,"errorMessage":"React Hook {hook_name} received a function whose dependencies are unknown.","messagePattern":"React Hook (.+?) received a function whose dependencies are unknown\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/exhaustive_deps.rs","lineNumber":61,"sourceCode":"\nfn missing_callback_diagnostic(hook_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"React hook {hook_name} requires an effect callback.\"))\n        .with_label(span)\n        .with_help(\"Did you forget to pass a callback to the hook?\")\n        .with_error_code_scope(SCOPE)\n}\n\nfn dependency_array_required_diagnostic(hook_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"React Hook {hook_name} does nothing when called with only one argument.\"\n    ))\n    .with_label(span)\n    .with_help(\"Did you forget to pass an array of dependencies?\")\n    .with_error_code_scope(SCOPE)\n}\n\nfn unknown_dependencies_diagnostic(hook_name: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"React Hook {hook_name} received a function whose dependencies are unknown.\"\n    ))\n    .with_help(\"Pass an inline function instead.\")\n    .with_label(span)\n    .with_error_code_scope(SCOPE)\n}\n\nfn async_effect_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Effect callbacks are synchronous to prevent race conditions.\")\n        .with_label(span)\n        .with_help(\"Consider putting the asynchronous code inside a function and calling it from the effect.\")\n        .with_error_code_scope(SCOPE)\n}\n\nfn missing_dependency_diagnostic(\n    hook_name: &str,\n    deps: &[Name<'_>],\n    span: Span,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/exhaustive_deps.rs#L43-L79","documentation":"Raised by react/exhaustive-deps when a hook receives a function whose dependencies cannot be statically determined, such as a function returned from another function or an imported opaque callback. The linter cannot verify the dependency list.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/exhaustive_deps.rs:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an inline function literal to the hook so its dependencies can be statically checked.","Move the callback definition into the component or wrap it with useCallback."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}