jackwener/OpenCLI · error · ArgumentError
facebook marketplace-inbox --limit must be a positive intege
Error message
facebook marketplace-inbox --limit must be a positive integer
What it means
normalizeLimit validates the --limit argument for the facebook marketplace-inbox command: the value (default 20) must be a positive integer, otherwise it throws ArgumentError('facebook marketplace-inbox --limit must be a positive integer'). Valid values are capped at 100.
Source
Thrown at clis/facebook/marketplace-inbox.js:7
import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, AuthRequiredError, CommandExecutionError, EmptyResultError } from '@jackwener/opencli/errors';
function normalizeLimit(value) {
const limit = Number(value ?? 20);
if (!Number.isInteger(limit) || limit <= 0) {
throw new ArgumentError('facebook marketplace-inbox --limit must be a positive integer');
}
return Math.min(limit, 100);
}
cli({
site: 'facebook',
name: 'marketplace-inbox',
access: 'read',
description: 'List recent Facebook Marketplace buyer/seller conversations',
domain: 'www.facebook.com',
strategy: Strategy.COOKIE,
args: [
{ name: 'limit', type: 'int', default: 20, help: 'Number of conversations to return' },
],
columns: ['index', 'buyer', 'listing', 'snippet', 'time', 'unread'],
func: async (page, args) => {
if (!page) throw new CommandExecutionError('Browser session required for facebook marketplace-inbox');
const limit = normalizeLimit(args.limit);View on GitHub (pinned to 49907e53dc)
Solutions
- Pass a positive integer, e.g. --limit 20 (max 100).
- Check the shell variable feeding --limit is set and numeric.
- Quote/validate inputs in scripts before invoking the command.
- Omit --limit entirely to use the default of 20.
Example fix
// before
opencli facebook marketplace-inbox --limit "$LIMIT"
// after
LIMIT=${LIMIT:-20}
opencli facebook marketplace-inbox --limit "$((LIMIT > 0 ? LIMIT : 20))" Defensive patterns
Strategy: validation
Validate before calling
function parseLimit(raw, fallback = 20) {
const v = raw ?? fallback;
const n = Number(v);
if (!Number.isInteger(n) || n <= 0) throw new TypeError('--limit must be a positive integer');
return Math.min(n, 100);
}
// run parseLimit(process.argv.limit) before invoking the command Type guard
function isValidLimit(v) {
return Number.isInteger(Number(v)) && Number(v) > 0;
} Try / catch
try {
await cli.run(['facebook', 'marketplace-inbox', '--limit', String(limit)]);
} catch (err) {
if (/--limit must be a positive integer/.test(err.message)) {
limit = 20; // fall back to default
} else throw err;
} Prevention
- Validate/normalize limit inputs in scripts before passing --limit.
- Guard shell variables so empty/unset values fall back to 20.
- Pass integers only; avoid floats and non-numeric strings.
- Omit --limit to use the built-in default of 20.
When it happens
Trigger: Calling the marketplace-inbox command with --limit 0, a negative number, a non-integer (e.g. 2.5), or a non-numeric string such as --limit abc or --limit '10x'.
Common situations: Shell scripts interpolating empty/unset variables into --limit; users passing floats or strings copied from docs; automation templates with malformed defaults; forgetting that 0 is rejected.
Related errors
- Argument "content" is required.
- Jike search query cannot be empty
- --limit must be a positive integer
- --limit must be an integer between 1 and ${MAX_LIMIT}
- ${label} is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/049676bec7248cb4.
Report an issue: GitHub.