oxc-project/oxc · error · OxcDiagnostic
Expected to return a value in render function.
Error message
Expected to return a value in render function.
What it means
Emitted by run of the vue require-render-return rule when a component's render function has at least one code path that does not return a value (checked via definitely_returns_in_all_codepaths). It is a control-flow guard: render must always return a VNode or rendering silently fails.
Source
Thrown at crates/oxc_linter/src/rules/vue/require_render_return.rs:14
use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use crate::{
AstNode,
context::LintContext,
rule::Rule,
utils::{definitely_returns_in_all_codepaths, is_vue_component_options_object},
};
fn require_render_return_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Expected to return a value in render function.")
.with_help("All code paths inside a render function must return a value.")
.with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct RequireRenderReturn;
declare_oxc_lint!(
/// ### What it does
///
/// Enforce that a `render` function always returns a value.
///
/// ### Why is this bad?
///
/// A Vue component's `render` function must produce a VNode tree. If a
/// code path falls through without returning, Vue receives `undefined`
/// and silently renders nothing.
///View on GitHub (pinned to e1e7af627c)
Solutions
- Ensure every branch of the render function returns a VNode, including else branches and early returns
- Add a final fallback return statement, e.g. return h('div')
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/vue/require_render_return.rs:14 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/f1669e6c14658c82.
Report an issue: GitHub.