continuedev/continue · error · Error

No rootPath provided for relative file path

Error message

No rootPath provided for relative file path

What it means

getContentFromFilePath resolves relative paths first against cwd; if the file isn't found there and no rootPath was supplied to the RegistryClient, it cannot resolve the relative path and throws.

Source

Thrown at packages/config-yaml/src/registryClient.ts:52

  private getContentFromFilePath(filepath: string): string {
    if (filepath.startsWith("file://")) {
      // For Windows file:///C:/path/to/file, we need to handle it properly
      // On other systems, we might have file:///path/to/file
      return fs.readFileSync(new URL(filepath), "utf8");
    } else if (path.isAbsolute(filepath)) {
      return fs.readFileSync(filepath, "utf8");
    } else {
      // Try to resolve relative to current working directory first
      const resolvedPath = path.resolve(filepath);
      if (fs.existsSync(resolvedPath)) {
        return fs.readFileSync(resolvedPath, "utf8");
      }
      // Fall back to rootPath if file doesn't exist relative to cwd
      if (this.rootPath) {
        return fs.readFileSync(path.join(this.rootPath, filepath), "utf8");
      }
      throw new Error("No rootPath provided for relative file path");
    }
  }
}

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Pass rootPath when constructing the RegistryClient so relative block paths resolve deterministically
  2. Or use absolute file paths in identifiers
  3. Or run the process from the directory containing the referenced files

Example fix

// before
new RegistryClient({});
// after
new RegistryClient({ rootPath: path.resolve(__dirname, 'blocks') });
Defensive patterns

Strategy: fallback

Validate before calling

const resolved = path.resolve(rootPath ?? process.cwd(), fileUri);
if (!fs.existsSync(resolved)) throw new Error(`Block file not found: ${resolved}`);

Try / catch

try { await registry.getContent(id); } catch (e) { if (e.message === 'No rootPath provided for relative file path') { /* retry with absolute path */ } }

Prevention

When it happens

Trigger: getContent with a relative fileUri where the file doesn't exist relative to the current working directory and the client was constructed without rootPath.

Common situations: Running the process from a different directory than assumed (CLI vs test cwd), constructing RegistryClient without the rootPath option, path typos making the cwd lookup miss.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/6ff418719179c99f. Report an issue: GitHub.