{"record":{"id":"5e699914f119c603","repo":"risingwavelabs/risingwave","slug":"invalid-entry-path-obtained-from-fs-read-dir","errorCode":null,"errorMessage":"invalid entry_path obtained from fs::read_dir","messagePattern":"invalid entry_path obtained from fs::read_dir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/jni_core/src/jvm_runtime.rs","lineNumber":68,"sourceCode":"\nfn build_jvm_with_native_registration() -> anyhow::Result<JavaVM> {\n    let libs_path = locate_libs_path().context(\"failed to locate connector libs\")?;\n    tracing::info!(path = %libs_path.display(), \"located connector libs\");\n\n    let mut class_vec = vec![];\n\n    let entries = fs::read_dir(&libs_path).context(if cfg!(debug_assertions) {\n        \"failed to read connector libs; \\\n        for RiseDev users, please check if ENABLE_BUILD_RW_CONNECTOR is set with `risedev configure`\"\n    } else {\n        \"failed to read connector libs, \\\n        please check if env var CONNECTOR_LIBS_PATH is correctly configured\"\n    })?;\n    for entry in entries.flatten() {\n        let entry_path = entry.path();\n        if entry_path.file_name().is_some() {\n            let path = fs::canonicalize(entry_path)\n                .expect(\"invalid entry_path obtained from fs::read_dir\");\n            class_vec.push(path.to_str().unwrap().to_owned());\n        }\n    }\n\n    // move risingwave-source-cdc to the head of classpath, because we have some patched Debezium classes\n    // in this jar which needs to be loaded first.\n    let mut new_class_vec = Vec::with_capacity(class_vec.len());\n    for path in class_vec {\n        if path.contains(\"risingwave-source-cdc\") {\n            new_class_vec.insert(0, path.clone());\n        } else {\n            new_class_vec.push(path.clone());\n        }\n    }\n    class_vec = new_class_vec;\n\n    let jvm_heap_size = if let Ok(heap_size) = std::env::var(\"JVM_HEAP_SIZE\") {\n        heap_size","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/jni_core/src/jvm_runtime.rs#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"Broken symlinks in the libs directory, partially-extracted or concurrently-updated connector packages, mounted network filesystems with stale entries.","solutions":["Run `ls -l` (or `find -L libs -type f`) on CONNECTOR_LIBS_PATH to find broken symlinks and fix or remove them.","Re-download/re-extract the connector package to restore missing files.","Ensure nothing deletes/replaces jars while the process is starting.","Prefer real files over symlinks in the libs directory."],"exampleFix":"// before\nln -s /nonexistent/debezium.jar libs/debezium.jar\n// after\nln -s /opt/connectors/debezium-1.9.7.jar libs/debezium.jar","handlingStrategy":"validation","validationCode":"find -L \"$CONNECTOR_LIBS_PATH\" -type f >/dev/null || { echo 'broken symlink or missing file in libs dir'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit the libs directory for broken symlinks before starting the service.","Avoid deleting/replacing jars while the process is starting.","Copy jars instead of symlinking when packaging containers.","Run integrity checks (file presence) as a startup health gate."],"tags":["jvm","filesystem","panic","classpath"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}