nodejs/node · error · Exception

{} is not a file

Error message

{} is not a file

What it means

The adb-d8 file server's second guard: even after a requested path passes the root-prefix check, it must point at a real regular file. If the resolved absolute path is a directory, a broken symlink, or simply doesn't exist, the server raises rather than trying to read it.

Source

Thrown at deps/v8/tools/adb-d8.py:44

import subprocess
import SocketServer # TODO(leszeks): python 3 compatibility

def CreateFileHandlerClass(root_dirs, verbose):
  class FileHandler(SocketServer.BaseRequestHandler):
    def handle(self):
      data = self.request.recv(1024);
      while data[-1] != "\0":
        data += self.request.recv(1024);

      filename = data[0:-1]

      try:
        filename = os.path.abspath(filename)

        if not any(filename.startswith(root) for root in root_dirs):
          raise Exception("{} not in roots {}".format(filename, root_dirs))
        if not os.path.isfile(filename):
          raise Exception("{} is not a file".format(filename))

        if verbose:
          sys.stdout.write("Serving {}\r\n".format(os.path.relpath(filename)))

        with open(filename) as f:
          contents = f.read();
          self.request.sendall(struct.pack("!i", len(contents)))
          self.request.sendall(contents)

      except Exception as e:
        if verbose:
          sys.stderr.write(
            "Request failed ({})\n".format(e).replace('\n','\r\n'))
        self.request.sendall(struct.pack("!i", -1))

  return FileHandler

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Build the requested artifact on the host first so the file actually exists.
  2. Point the device/d8 at the correct file path (check for typos or a missing build-prefix like out/Release/).
  3. If using symlinks, ensure the link target is present on the host.

Example fix

# before: request out/Release/d8 but only out/Default/d8 was built
# after: build the Release target, or request out/Default/d8
Defensive patterns

Strategy: validation

Validate before calling

import os
assert os.path.isfile(filename), f'{filename} is not a regular file; build it or fix the path'

Prevention

When it happens

Trigger: Raised in FileHandler.handle() when `not os.path.isfile(filename)` is true, immediately after the roots-prefix check passes.

Common situations: Device requests a path that exists in the source layout but wasn't built (e.g. a .so that only appears after `make`); requesting a directory by mistake; a symlink target that's missing on the host; stale d8 payload manifest referencing deleted files.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/e577fc11f1b38710. Report an issue: GitHub.