jackwener/OpenCLI · error · ArgumentError
xianyu publish images supports at most ${MAX_IMAGES} files
Error message
xianyu publish images supports at most ${MAX_IMAGES} files What it means
validateImagePaths throws ArgumentError when more than MAX_IMAGES (9) comma-separated image paths are supplied for xianyu publish. Xianyu listings allow at most 9 photos, so the library enforces the cap before any file I/O.
Source
Thrown at clis/xianyu/publish.js:62
throw new ArgumentError(`xianyu publish ${label} must be a positive price`);
}
return text;
}
function validateCondition(value) {
const condition = requireText(value, 'condition');
if (!CONDITION_CHOICES.includes(condition)) {
throw new ArgumentError(`xianyu publish condition must be one of: ${CONDITION_CHOICES.join(', ')}`);
}
return condition;
}
function validateImagePaths(raw) {
if (!raw) return [];
const paths = String(raw).split(',').map((item) => item.trim()).filter(Boolean);
if (paths.length === 0) return [];
if (paths.length > MAX_IMAGES) {
throw new ArgumentError(`xianyu publish images supports at most ${MAX_IMAGES} files`);
}
return paths.map((item) => {
const absPath = path.resolve(item);
const ext = path.extname(absPath).toLowerCase();
if (!SUPPORTED_IMAGE_EXTENSIONS.has(ext)) {
throw new ArgumentError(`Unsupported image format "${ext}". Supported: jpg, jpeg, png, webp`);
}
const stat = fs.statSync(absPath, { throwIfNoEntry: false });
if (!stat || !stat.isFile()) {
throw new ArgumentError(`Not a valid image file: ${absPath}`);
}
return absPath;
});
}
function normalizePublishArgs(kwargs) {
const price = parsePositivePrice(kwargs.price, 'price');
if (price == null) {View on GitHub (pinned to 49907e53dc)
Solutions
- Trim the images list to 9 or fewer entries, keeping the best photos
- Split into multiple listings if more than 9 photos are needed
- Count paths before calling and truncate with images.split(',').slice(0, 9)
Example fix
// before
await publish({ images: paths.join(',') }); // paths.length = 12
// after
await publish({ images: paths.slice(0, 9).join(',') }); Defensive patterns
Strategy: validation
Validate before calling
const paths = String(images).split(',').map((s) => s.trim()).filter(Boolean);
if (paths.length > 9) {
throw new Error(`images supports at most 9 files, got ${paths.length}`);
} Type guard
null
Try / catch
try {
await publish({ images });
} catch (e) {
if (e instanceof ArgumentError && /at most 9 files/.test(e.message)) {
const kept = images.split(',').slice(0, 9).join(',');
await publish({ images: kept });
} else throw e;
} Prevention
- Cap the photo list to 9 before invoking publish
- De-duplicate paths so retries don't exceed the cap
- Split oversized photo sets into multiple listings
When it happens
Trigger: Calling normalizePublishArgs with kwargs.images containing 10 or more comma-separated paths, e.g. 'a.jpg,b.jpg,...,j.jpg'.
Common situations: Bulk uploads of an entire product shoot (10+ photos), passing a whole directory listing as a comma-joined string, or scripts appending photos per product variant without deduplication.
Related errors
- archive search limit must be <= 100
- coingecko derivatives limit must be <= 500
- limit must be an integer between 1 and 15 (dianping single p
- limit must be an integer between 1 and ${max}
- 'limit', 'must be a positive integer ≤ 200'
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2c61bf1b56388972.
Report an issue: GitHub.