juicedata/juicefs · info

%s

Error message

%s

What it means

jfs_callback is the C entry point the JuiceFS JNI layer uses to deliver log/error messages to the JVM. The message '%s' is not a template error itself; the C code prints whatever message string the Go/JNI side passed via fprintf(stderr, "%s", msg) (or forwards it to a registered Java callback). Seeing raw text here means a lower-level message reached stderr through this pass-through channel.

Source

Thrown at sdk/java/libjfs/callback.c:42

static void (*log_callback)(const char *msg);

typedef void LogCallBack(const char *msg);

void jfs_set_logger(void*p);

EXPORT void jfs_set_callback(LogCallBack *callback)
{
    log_callback = callback;
    jfs_set_logger(callback);
}

EXPORT void jfs_callback(const char *msg)
{
    if (log_callback != NULL) {
        (*log_callback)(msg);
    } else {
        fprintf(stderr, "%s", msg);
    }
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Register a log callback (the JNI log_callback / corresponding Java-side hook) so messages go to your logger instead of raw stderr
  2. Inspect the printed message itself for the actual underlying problem (init failure, missing libjfs, metadata errors)
  3. Check that libjfs loaded correctly and the JuiceFS URI/mount settings are valid

Example fix

// before
// no callback; messages appear as raw fprintf(stderr) text
// after
// install the log callback so jfs_callback forwards to your logger
lib.jfs_init(...); /* plus register log_callback before use */
Defensive patterns

Strategy: try-catch

Validate before calling

/* ensure libjfs is loadable before use: */ System.loadLibrary("jfs");

Try / catch

try {
  // JNI-backed operations
} catch (UnsatisfiedLinkError | IOException e) {
  LOG.error("JuiceFS native message: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Any Go-side log/panic message routed through the JNI log hook while no Java log_callback is registered (it goes straight to stderr), or with one registered (it is forwarded to the callback).

Common situations: Java clients embedding JuiceFS via sdk/java see native stderr output because the logging callback was never installed; low-level mount/init messages appear on the console instead of the application's log framework.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/704fbe6fec56c148. Report an issue: GitHub.