yikart/AiToEarn · warning · Error
Failed to get image dimensions
Error message
Failed to get image dimensions
What it means
deleteVideo requires both videoId and accountId in the request body. Missing either triggers BadRequestException('videoId和accountId是必须的'). accountId resolves the stored access token used to authorize the delete call against TikTok.
Source
Thrown at project/aitoearn-backend/apps/aitoearn-ai/src/core/agent/mcp/volcengine/volcengine.utils.ts:98
*/
static async getImageDimensions(
imageUrl: string,
logger: Logger,
): Promise<{ width: number, height: number }> {
try {
logger.debug('[getImageDimensions] Fetching image dimensions', { url: imageUrl })
const response = await fetch(imageUrl)
if (!response.ok) {
throw new Error(`HTTP ${response.status}`)
}
const arrayBuffer = await response.arrayBuffer()
const buffer = Buffer.from(arrayBuffer)
const dimensions = sizeOf(buffer)
if (!dimensions.width || !dimensions.height) {
throw new Error('Failed to get image dimensions')
}
logger.debug('[getImageDimensions] Image dimensions retrieved', {
width: dimensions.width,
height: dimensions.height,
})
return {
width: dimensions.width,
height: dimensions.height,
}
}
catch (error) {
const errorMessage = getErrorMessage(error)
logger.error('[getImageDimensions] Failed to get image dimensions', {
error: errorMessage,
url: imageUrl,
})View on GitHub (pinned to d3aa8bea5b)
Solutions
- Send { "videoId": "<id>", "accountId": "<id>" } with Content-Type: application/json.
- Match the exact camelCase key names expected by @Body('videoId') and @Body('accountId').
- Carry accountId through from the video list model before issuing the delete.
Example fix
// before
await api.post('/plat/tiktok/video/delete', { video_id });
// after
await api.post('/plat/tiktok/video/delete', { videoId, accountId }, { headers: { 'Content-Type': 'application/json' } }); Defensive patterns
Strategy: validation
Validate before calling
if (!videoId || !accountId) throw new Error('videoId和accountId是必须的');
await api.post('/plat/tiktok/video/delete', { videoId, accountId }, { headers: { 'Content-Type': 'application/json' } }); Type guard
function isDeleteBody(v): v is { videoId: string; accountId: string } {
return typeof (v as any)?.videoId === 'string' && (v as any).videoId.length > 0 && typeof (v as any)?.accountId === 'string' && (v as any).accountId.length > 0;
} Try / catch
try {
await api.post('/plat/tiktok/video/delete', { videoId, accountId });
} catch (e) {
if (e.response?.status === 400) console.error('删除请求体缺少videoId/accountId');
throw e;
} Prevention
- Use exact camelCase body keys matching @Body('videoId')/@Body('accountId')
- Carry accountId through from list models into delete actions
- Type the delete client function with required params so omission fails at compile time
When it happens
Trigger: POST the delete route with body missing videoId or accountId, or sending them under different keys (e.g. video_id) so @Body() reads undefined.
Common situations: Bulk-delete loops that pass only the video object without its parent account context, or snake_case/camelCase key mismatch between client and server DTOs.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- No response from Gemini
- HTTP ${response.status}
- AiCallFailed
- tweetId, rating和accountId是必须的
- No subtitle entries in response
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/240bf92d55e4a4f4.
Report an issue: GitHub.