oxc-project/oxc · warning

Tried to get an allocator from an empty `FixedSizeAllocatorP

Error message

Tried to get an allocator from an empty `FixedSizeAllocatorPool`

What it means

Diagnostic from oxlint's vue/require-direct-export rule (crates/oxc_linter/src/rules/vue/require_direct_export.rs). The component options object literal in a component script should be exported directly (`export default {...}` / `export default defineComponent({...})`) rather than assigned to an intermediate variable first. The extra variable adds indirection with no benefit and can confuse tooling that expects the default export to be the literal. The `disallowFunctionalComponentFunction` option (default false) also reports functional components defined as plain functions.

Source

Thrown at crates/oxc_allocator/src/pool/fixed_size.rs:205

    ///
    /// # Panics
    ///
    /// * Panics if the pool is empty.
    /// * Panics if the underlying mutex is poisoned.
    #[cfg(not(target_os = "windows"))]
    pub fn get(&self) -> Allocator {
        // Try to get an allocator from the pool.
        // This is in a block, so that `Mutex` lock is held for the shortest possible time.
        let maybe_allocator = {
            let mut allocators_guard = self.allocators.lock().unwrap();
            allocators_guard.pop()
        };

        // Panic if pool is empty. Should never happen if the pool was created with the correct `thread_count`.
        if let Some(allocator) = maybe_allocator {
            allocator.into_inner()
        } else {
            panic!("Tried to get an allocator from an empty `FixedSizeAllocatorPool`")
        }
    }

    /// Retrieve an [`Allocator`] from the pool, blocking until one becomes available if the pool is currentlyempty.
    ///
    /// Windows implementation.
    ///
    /// # Panics
    /// Panics if the underlying mutex is poisoned.
    #[cfg(target_os = "windows")]
    pub fn get(&self) -> Allocator {
        // Try to get an allocator from the pool.
        // If pool is empty, wait for notification that the pool isn't empty any more.
        // After receiving a notification, we must still check that pool is not empty,
        // (no `.pop().unwrap_unchecked()` here), because `Condvar` can produce spurious wakeups.
        let mut allocators_guard = self.allocators.lock().unwrap();
        loop {
            if let Some(allocator) = allocators_guard.pop() {

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Inline the literal: `export default { ... }`.
  2. Attach any JSDoc or type annotations directly above the export statement instead of an intermediate variable.
  3. If the indirection is deliberate (e.g. recursive self-reference by name), suppress with a scoped oxlint-disable comment.
  4. Enable `disallowFunctionalComponentFunction` only if function-style components should be reported too.

Example fix

// before
const component = { props: [], template: '<div/>' };
export default component;

// after
export default { props: [], template: '<div/>' };
Defensive patterns

Strategy: validation

Validate before calling

// warn when an SFC script exports a variable instead of the literal
const m = scriptBlock.match(/export\s+default\s+[A-Za-z_$][\w$]*\s*;?\s*$/);
if (m) console.warn('export the component object literal directly');

Prevention

When it happens

Trigger: `const component = { ... }; export default component;` in a component script, or — when `disallowFunctionalComponentFunction: true` — a functional component function that is not directly exported. The help text says to export the component object directly instead of assigning it to a variable first.

Common situations: Habitual named-variable style carried over from plain ES modules; codemods extracting components into variables; wanting JSDoc attached to the variable; teams toggling defineComponent wrappers.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/9f0361f8d24e893b. Report an issue: GitHub.