cube-js/cube · error

Unrecognized log level: {}

Error message

Unrecognized log level: {}

What it means

init_cube_logger parses CUBESTORE_GLOBAL_LOG_LEVEL and panics if string_to_level doesn't recognize the value. Valid values are standard log levels (error/warn/info/debug/trace, case-insensitive). A bad value aborts startup.

Source

Thrown at rust/cubestore/cubestore/src/util/logger.rs:22

use std::env;

pub fn string_to_level(text: String) -> std::result::Result<Level, String> {
    let level = match text.as_str() {
        "error" => Level::Error,
        "warn" => Level::Warn,
        "info" => Level::Info,
        "debug" => Level::Debug,
        "trace" => Level::Trace,
        _ => return Err(text),
    };
    Ok(level)
}

/// Logger will add 'CUBESTORE_LOG_CONTEXT' to all messages.
/// Set it during `procspawn` to help distinguish processes in the logs.
pub fn init_cube_logger(enable_telemetry: bool) {
    let global_level = env::var("CUBESTORE_GLOBAL_LOG_LEVEL").map_or(Level::Error, |x| {
        string_to_level(x).unwrap_or_else(|x| panic!("Unrecognized log level: {}", x))
    });
    let cubestore_log_level = env::var("CUBESTORE_LOG_LEVEL").map_or(Level::Info, |x| {
        string_to_level(x).unwrap_or_else(|x| panic!("Unrecognized log level: {}", x))
    });
    let df_log_level = env::var("CUBESTORE_DATAFUSION_LOG_LEVEL").map_or(global_level, |x| {
        string_to_level(x).unwrap_or_else(|x| panic!("Unrecognized log level: {}", x))
    });

    let logger = SimpleLogger::new()
        .with_level(global_level.to_level_filter())
        .with_module_level("cubestore", cubestore_log_level.to_level_filter())
        .with_module_level("datafusion", df_log_level.to_level_filter());

    let mut ctx = format!("pid:{}", std::process::id());
    if let Ok(extra) = env::var("CUBESTORE_LOG_CONTEXT") {
        ctx += " ";
        ctx += &extra;
    }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Set CUBESTORE_GLOBAL_LOG_LEVEL to one of: error, warn, info, debug, trace (case-insensitive)
  2. Check the exact value in your environment: printenv CUBESTORE_GLOBAL_LOG_LEVEL
  3. Remove the variable entirely to use the default (Error for global level)

Example fix

// before
CUBESTORE_GLOBAL_LOG_LEVEL=verbose
// after
CUBESTORE_GLOBAL_LOG_LEVEL=info
Defensive patterns

Strategy: validation

Validate before calling

const VALID = new Set(['error','warn','info','debug','trace']);
const lvl = process.env.CUBESTORE_GLOBAL_LOG_LEVEL;
if (lvl && !VALID.has(lvl.toLowerCase())) throw new Error(`CUBESTORE_GLOBAL_LOG_LEVEL must be one of ${[...VALID]}`);

Prevention

When it happens

Trigger: Setting CUBESTORE_GLOBAL_LOG_LEVEL to anything string_to_level rejects, e.g. CUBESTORE_GLOBAL_LOG_LEVEL=verbose or =logging, then starting Cube Store.

Common situations: Typos in deployment config/manifests; copying level names from other frameworks (e.g. 'fatal', 'none', numeric levels); Kubernetes/env-file misconfiguration.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/eb920ff3aaf22ae2. Report an issue: GitHub.