risingwavelabs/risingwave · critical

invalid entry_path obtained from fs::read_dir

Error message

invalid entry_path obtained from fs::read_dir

What it means

While building the JVM classpath, each entry from reading the CONNECTOR_LIBS_PATH (or default `./libs`) directory is canonicalized; a failure is unwrapped with this expect message, panicking the process. fs::read_dir entries should always be canonicalizable, so this is treated as an internal invariant violation, usually caused by broken symlinks or the directory changing while iterating.

Solutions

  1. Run `ls -l` (or `find -L libs -type f`) on CONNECTOR_LIBS_PATH to find broken symlinks and fix or remove them.
  2. Re-download/re-extract the connector package to restore missing files.
  3. Ensure nothing deletes/replaces jars while the process is starting.
  4. Prefer real files over symlinks in the libs directory.

Example fix

// before
ln -s /nonexistent/debezium.jar libs/debezium.jar
// after
ln -s /opt/connectors/debezium-1.9.7.jar libs/debezium.jar
Defensive patterns

Strategy: validation

Validate before calling

find -L "$CONNECTOR_LIBS_PATH" -type f >/dev/null || { echo 'broken symlink or missing file in libs dir'; exit 1; }

Prevention

When it happens

Trigger: fs::canonicalize(entry_path) fails during build_jvm_with_native_registration, e.g. a symlink in CONNECTOR_LIBS_PATH pointing to a deleted file, or a jar removed between read_dir and canonicalize.

Common situations: Broken symlinks in the libs directory, partially-extracted or concurrently-updated connector packages, mounted network filesystems with stale entries.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/5e699914f119c603. Report an issue: GitHub.

Appendix: source

Thrown at src/jni_core/src/jvm_runtime.rs:68

fn build_jvm_with_native_registration() -> anyhow::Result<JavaVM> {
    let libs_path = locate_libs_path().context("failed to locate connector libs")?;
    tracing::info!(path = %libs_path.display(), "located connector libs");

    let mut class_vec = vec![];

    let entries = fs::read_dir(&libs_path).context(if cfg!(debug_assertions) {
        "failed to read connector libs; \
        for RiseDev users, please check if ENABLE_BUILD_RW_CONNECTOR is set with `risedev configure`"
    } else {
        "failed to read connector libs, \
        please check if env var CONNECTOR_LIBS_PATH is correctly configured"
    })?;
    for entry in entries.flatten() {
        let entry_path = entry.path();
        if entry_path.file_name().is_some() {
            let path = fs::canonicalize(entry_path)
                .expect("invalid entry_path obtained from fs::read_dir");
            class_vec.push(path.to_str().unwrap().to_owned());
        }
    }

    // move risingwave-source-cdc to the head of classpath, because we have some patched Debezium classes
    // in this jar which needs to be loaded first.
    let mut new_class_vec = Vec::with_capacity(class_vec.len());
    for path in class_vec {
        if path.contains("risingwave-source-cdc") {
            new_class_vec.insert(0, path.clone());
        } else {
            new_class_vec.push(path.clone());
        }
    }
    class_vec = new_class_vec;

    let jvm_heap_size = if let Ok(heap_size) = std::env::var("JVM_HEAP_SIZE") {
        heap_size

View on GitHub (pinned to 6469eb736d)