jackwener/OpenCLI · warning · EmptyResultError

No posts found in this Band

Error message

No posts found in this Band

What it means

The Band posts command threw an EmptyResultError because the scraper/browser evaluation returned no posts (null, empty array, or missing data) for the requested Band. The CLI throws this deliberately so an empty scrape is reported as a clean 'no results' condition instead of silently outputting nothing. It usually means the Band exists but has no visible posts, or the logged-in session could not see them.

Source

Thrown at clis/band/posts.js:91

          // Post body text (strip Band markup tags, truncate for listing).
          const bodyEl = el.querySelector('.postText._postText');
          const content = bodyEl
            ? stripTags(norm(bodyEl.innerText || bodyEl.textContent)).slice(0, 120)
            : '';

          // Comment count is in span.count inside the count area.
          const commentEl = el.querySelector('span.count');
          const comments = commentEl ? parseInt((commentEl.textContent || '').replace(/[^0-9]/g, ''), 10) || 0 : 0;

          if (results.length >= limit) break;
          results.push({ date, author, content, comments, url });
        }

        return results;
      })()
    `);
        if (!posts || posts.length === 0) {
            throw new EmptyResultError('band posts', 'No posts found in this Band');
        }
        return posts;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the Band actually has posts by opening it in a browser with the same logged-in account.
  2. Re-authenticate / refresh session cookies so the scraper can see the Band's content, then retry.
  3. Confirm the band identifier/URL passed to the command is correct and points at the intended Band.
  4. If the Band genuinely has no posts, treat this as an expected empty result and skip or handle it in your script.

Example fix

// before
const posts = await run('band posts --band myband'); // throws when empty
// after
let posts;
try {
  posts = await run('band posts --band myband');
} catch (e) {
  if (e.name === 'EmptyResultError') posts = [];
  else throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the band has posts before calling
const bandPage = await fetch(bandUrl, { headers: { cookie: sessionCookie } });
if (!bandPage.ok || !(await bandPage.text()).includes('post')) {
  console.warn('Band appears empty or inaccessible; skipping posts fetch');
}

Type guard

function hasPosts(v) {
  return Array.isArray(v) && v.length > 0;
}

Try / catch

try {
  const posts = await bandPosts(bandId);
} catch (e) {
  if (e.name === 'EmptyResultError') {
    return []; // treat as empty, not fatal
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the `band posts` command when the in-browser evaluation script returns posts that are null or an array of length 0. Specifically: the Band URL resolves but contains no post elements in the DOM, or the extraction script's returned expression evaluates to no rows.

Common situations: Targeting a newly created or empty Band; scraping a private/closed Band whose posts are not visible to the current session cookie; Band pages that lazy-load posts and render none before the extraction script runs; a typo'd band name/URL landing on a valid but empty view; session expiry causing the extractor to find zero visible posts.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/f9c1339a94256d51. Report an issue: GitHub.