juicedata/juicefs · error · TypeError

warmup() got an unexpected keyword argument '{k}'

Error message

warmup() got an unexpected keyword argument '{k}'

What it means

warmup() accepts only a fixed set of keyword arguments (paths plus kwargs keys such as 'threads', 'isEvict', 'isCheck'). Any other key in kwargs raises TypeError("warmup() got an unexpected keyword argument '{k}'").

Source

Thrown at sdk/python/juicefs/juicefs/juicefs.py:450

            elif entry.get("Children") is not None:
                for v in entry["Children"]:
                    parseSummary(v, removefields)

        parseSummary(res, ["Inode"])
        self.lib.free(buf)
        return res

    def warmup(self, paths, threads=10, evict=False, check=False, background=False, **kwargs):
        # numthreads=10, background=False, isEvict=False, isCheck=False,
        for k in kwargs:
            if k == 'numthreads':
                threads = kwargs[k]
            elif k == 'isEvict':
                evict = kwargs[k]
            elif k == 'isCheck':
                check = kwargs[k]
            else:
                raise TypeError(f"warmup() got an unexpected keyword argument '{k}'")

        """Warm up a file or a directory."""
        if type(paths) is not list:
            paths = [paths]

        buf = c_void_p()

        n = self.lib.jfs_warmup(c_int64(_tid()), c_int64(self.h), json.dumps(paths).encode(), c_int32(threads), c_bool(background), c_bool(evict), c_bool(check), byref(buf))
        res = json.loads(str(string_at(buf, n), encoding='utf-8'))
        self.lib.free(buf)
        return res

    def status(self, trash=False, session=0):
        """Get the status of the volume and client sessions."""
        buf = c_void_p()
        n = self.lib.jfs_status(c_int64(_tid()), c_int64(self.h), c_bool(trash), c_bool(session), byref(buf))
        res = json.loads(str(string_at(buf, n), encoding='utf-8'))
        self.lib.free(buf)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Use only the supported kwargs: threads, isEvict, isCheck
  2. Rename misspelled kwargs to the exact supported names (e.g. evict -> isEvict)
  3. Check the warmup signature in sdk/python/juicefs/juicefs/juicefs.py for your installed version

Example fix

// before
fs.warmup('/data', evict=True, purge=False)
// after
fs.warmup('/data', isEvict=True, isCheck=False, threads=4)
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {'threads', 'isEvict', 'isCheck'}
bad = set(kwargs) - ALLOWED
if bad:
    raise TypeError(f'unsupported warmup kwargs: {bad}')

Try / catch

try:
    fs.warmup(path, **opts)
except TypeError as e:
    logger.warning('warmup kwargs rejected: %s', e)

Prevention

When it happens

Trigger: Calling warmup(path, background=True), warmup(p, evict=1) (wrong name; must be isEvict), or any misspelled/unsupported kwarg like purge=, through=.

Common situations: Typos in kwarg names (evict vs isEvict, thread vs threads); copying kwargs from other fsspec/CLI warm-up APIs; version drift where an option exists in the CLI but not in this Python binding.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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