Skip to content

Cava module regression after PR #4682: 'Unknown module' when no cava_config specified #4725

@xav-ie

Description

@xav-ie

After PR #4682 (merged Dec 18, 2025), the cava module fails with:

[warning] module cava: Disabling module "cava", Unknown module

This happens when using waybar's cava module without a cava_config file specified, which worked correctly before PR #4682.

Root Cause

The refactoring in PR #4682 introduced a mismatch between cava_backend.cpp and cava_frontend.hpp:

cava_backend.cpp

The output method is saved, temporarily set to RAW for initialization, then restored to the original value:

Save original output method:

auto const output{prm_.output};

Restore original output method (BUG):

prm_.output = output;

cava_frontend.hpp

The frontend only accepts OUTPUT_RAW or OUTPUT_SDL_GLSL, rejecting all other output methods:

Switch statement that throws "Unknown module":

const std::shared_ptr<CavaBackend> backend_{waybar::modules::cava::CavaBackend::inst(config)};
switch (backend_->getPrm()->output) {
case ::cava::output_method::OUTPUT_RAW:
return new waybar::modules::cava::Cava(id, config);
break;
#ifdef HAVE_LIBCAVAGLSL
case ::cava::output_method::OUTPUT_SDL_GLSL:
return new waybar::modules::cava::CavaGLSL(id, config);
break;
#endif
default:
break;

Cava library default

When no config file is provided, cava defaults to OUTPUT_NONCURSES:

Default output method is "noncurses":
https://github.com/LukashonakV/cava/blob/256cf7aa7c893fb457d54477bd20758db3d79026/config.c#L819

Old code (pre-PR #4682)

The old implementation simply set OUTPUT_RAW once and never changed it:

Old cava.cpp:

prm_.output = cava::output_method::OUTPUT_RAW;

Flow Analysis

  1. Waybar config has no cava_config option → empty path passed to load_config()
  2. Cava library uses default output:method = noncursesOUTPUT_NONCURSES
  3. cava_backend.cpp saves OUTPUT_NONCURSES, sets to OUTPUT_RAW for init, then restores to OUTPUT_NONCURSES
  4. cava_frontend.hpp calls getPrm()->output → gets OUTPUT_NONCURSES
  5. Switch statement doesn't match OUTPUT_RAW or OUTPUT_SDL_GLSL
  6. Falls through to throw std::runtime_error("Unknown module")

Steps to Reproduce

  1. Use waybar built from current master (commit 97eb606 or later)
  2. Add cava module to waybar config without cava_config option:
"cava": {
  "framerate": 60,
  "bars": 12,
  "method": "pulse",
  "format-icons": ["", "", "", "", "", "", "", ""]
}
  1. Run waybar
  2. See warning: module cava: Disabling module "cava", Unknown module

Expected Behavior

Cava module should work without requiring a separate cava config file, as it did before PR #4682.

Suggested Fix

Either:

Option A: Don't restore the output method in cava_backend.cpp (line 267):

// prm_.output = output;  // Keep OUTPUT_RAW for waybar

Option B: Handle all output methods in cava_frontend.hpp, defaulting to raw Cava for non-GLSL methods:

switch (backend_->getPrm()->output) {
  case OUTPUT_SDL_GLSL:
    return new CavaGLSL(id, config);
  default:  // All other methods use raw text cava
    return new Cava(id, config);
}

System Info

  • waybar version: 0.14.0+date=2025-12-18_97eb606
  • OS: NixOS (Linux 6.18.2)
  • Built with cava support from flake input github:Alexays/waybar

Workaround

Create a cava config file with explicit method = raw in [output] section and reference via cava_config in waybar config. But this shouldn't be necessary for basic usage.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions