NousResearch/hermes-agent · error · ValueError

No valid entries found in dataset file: {self.dataset_file}

Error message

No valid entries found in dataset file: {self.dataset_file}

What it means

ValueError from BatchRunner._load_dataset() (batch_runner.py:672): the JSONL file was found and read, but after skipping blank lines, lines with invalid JSON, and lines missing the 'prompt' field, zero usable entries remain. The per-line warnings printed just before tell you which lines were dropped and why.

Source

Thrown at batch_runner.py:672

        dataset = []
        with open(self.dataset_file, 'r', encoding='utf-8') as f:
            for line_num, line in enumerate(f, 1):
                line = line.strip()
                if not line:
                    continue
                
                try:
                    entry = json.loads(line)
                    if 'prompt' not in entry:
                        print(f"⚠️  Warning: Line {line_num} missing 'prompt' field, skipping")
                        continue
                    dataset.append(entry)
                except json.JSONDecodeError as e:
                    print(f"⚠️  Warning: Invalid JSON on line {line_num}: {e}")
                    continue
        
        if not dataset:
            raise ValueError(f"No valid entries found in dataset file: {self.dataset_file}")
        
        return dataset
    
    def _create_batches(self) -> List[List[Tuple[int, Dict[str, Any]]]]:
        """
        Split dataset into batches with indices.
        
        Returns:
            List of batches, where each batch is a list of (index, entry) tuples
        """
        batches = []
        for i in range(0, len(self.dataset), self.batch_size):
            batch = [(idx, entry) for idx, entry in enumerate(self.dataset[i:i + self.batch_size], start=i)]
            batches.append(batch)
        
        return batches
    
    def _load_checkpoint(self) -> Dict[str, Any]:

View on GitHub (pinned to c896c09c42)

Solutions

  1. Re-read the ⚠️ warnings above the exception — they enumerate 'Line N missing prompt' vs 'Invalid JSON on line N', which tells you the failure mode directly.
  2. If fields are named differently, transform the dataset to {'prompt': ...} entries (jq or a one-liner) rather than editing batch_runner.
  3. If the file is one JSON array, flatten it: jq -c '.[]' in.json > out.jsonl.
  4. Validate the file before the run: parse every line and assert a 'prompt' key (see validationCode).

Example fix

# before — dataset uses 'input' instead of 'prompt'
{"input": "hello", "id": 1}

# after — flatten/renamed to the expected schema
{"prompt": "hello", "id": 1}

# one-off conversion:
# jq -c '{prompt: .input, id: .id}' in.jsonl > fixed.jsonl
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

def dataset_is_valid(path: str) -> bool:
    ok = 0
    for line in Path(path).read_text(encoding="utf-8").splitlines():
        line = line.strip()
        if not line:
            continue
        try:
            entry = json.loads(line)
        except json.JSONDecodeError:
            return False
        if not isinstance(entry, dict) or "prompt" not in entry:
            return False
        ok += 1
    return ok > 0

Try / catch

try:
    runner.load_dataset()
except ValueError as exc:
    # per-line warnings above the exception identify the bad lines
    raise SystemExit(f"dataset has no usable entries: {exc}") from exc

Prevention

When it happens

Trigger: Every line fails one of the two filters: json.loads raises (trailing comma, single quotes, truncated line) or the parsed object lacks a 'prompt' key — e.g. the file is actually JSON (one array), CSV, or a JSONL of a different schema ({'input': ...} instead of {'prompt': ...}).

Common situations: Dataset exported from another tool with different field names; a pretty-printed single JSON object per multiple lines (each physical line is not valid JSON); BOM/encoding artifacts breaking the first line; accidentally pointing at the wrong file (statistics.json, checkpoint.json).

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/6aafb06c2550b734. Report an issue: GitHub.