yikart/AiToEarn · warning · Error
No subtitle entries in response
Error message
No subtitle entries in response
What it means
checkAuth validates that the accountId query parameter is present before calling tikTokAuthService.isAuthorized. If the caller omits ?accountId=, a 400 BadRequestException with 'accountId是必须的' is thrown. This is a plain required-parameter guard.
Source
Thrown at project/aitoearn-backend/apps/aitoearn-ai/src/core/agent/mcp/subtitle.mcp.ts:182
},
},
{ text: prompt },
],
}],
config: {
responseMimeType: 'application/json',
},
})
// Step 4: 解析响应
const responseText = response.text
if (!responseText) {
throw new Error('No response from Gemini')
}
const subtitleData = JSON.parse(responseText) as { entries: SubtitleEntry[] }
if (!subtitleData.entries || subtitleData.entries.length === 0) {
throw new Error('No subtitle entries in response')
}
this.logger.debug({ entryCount: subtitleData.entries.length }, 'Subtitle entries parsed')
// Step 5: 生成 SRT 格式
const srtContent = this.generateSrtFromEntries(subtitleData.entries)
// Step 6: 上传 SRT 文件
this.logger.debug('Uploading SRT file')
const srtBuffer = Buffer.from(srtContent, 'utf-8')
const result = await this.assetsService.uploadFromBuffer(userId, srtBuffer, {
type: AssetType.Subtitle,
mimeType: 'text/plain',
filename: `subtitle-${Date.now()}.srt`,
})
return successResult(`Subtitle generated successfully!
View on GitHub (pinned to d3aa8bea5b)
Solutions
- Add ?accountId=<value> to the request URL.
- Confirm the client actually stored a TikTok account ID after OAuth completed.
- Check for empty-string accountId being sent by the frontend; treat undefined/empty before calling the API.
Example fix
// before
await axios.get('/api/plat/tiktok/auth/check');
// after
await axios.get(`/api/plat/tiktok/auth/check?accountId=${encodeURIComponent(accountId)}`); Defensive patterns
Strategy: validation
Validate before calling
function canCheckAuth(accountId) { return typeof accountId === 'string' && accountId.length > 0; }
if (!canCheckAuth(accountId)) throw new Error('accountId是必须的'); Type guard
function hasAccountId(v): v is string { return typeof v === 'string' && v.trim().length > 0; } Try / catch
try {
const { data } = await api.get('/plat/tiktok/auth/check', { params: { accountId } });
return data.authorized;
} catch (e) {
if (e.response?.status === 400) return false; // 视为未授权/参数缺失
throw e;
} Prevention
- Always encodeURIComponent the accountId in query strings
- Check the account was persisted after OAuth before polling auth status
- Add client-side form/URL builders that skip the call when accountId is falsy
When it happens
Trigger: GET /plat/tiktok/auth/check without the accountId query string, or with accountId present but an empty string.
Common situations: Frontend builds the URL without encoding the stored account ID, the account was never created so the ID variable is undefined, or the client calls the endpoint directly (e.g. curl/Postman) forgetting the query param.
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
- accountId, videoId和commentId是必须的
- videoId, userId和accountId是必须的
- accountId和视频大小是必须的
- accountId和publishId是必须的
- No response from Gemini
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/bf8cc5d1d38598db.
Report an issue: GitHub.