yikart/AiToEarn · warning · Error

No response from Gemini

Error message

No response from Gemini

What it means

revokeAuth requires accountId in the JSON body; when it is absent or empty the controller throws BadRequestException('accountId是必须的') before calling tikTokAuthService.revokeAuthorization. The authenticated system token is required but the account to revoke must also be named.

Source

Thrown at project/aitoearn-backend/apps/aitoearn-ai/src/core/agent/mcp/video-utils.mcp.ts:402

            parts: [
              {
                inlineData: {
                  mimeType: 'audio/mp3',
                  data: audioBuffer.toString('base64'),
                },
              },
              { text: prompt },
            ],
          }],
          config: {
            responseMimeType: 'application/json',
            responseJsonSchema: z.toJSONSchema(srtNodesSchema),
          },
        })

        const responseText = response.text
        if (!responseText) {
          throw new Error('No response from Gemini')
        }

        const result = z.safeParse(srtNodesSchema, JSON.parse(responseText))
        if (!result.success) {
          throw new Error(`Invalid subtitle data: ${z.prettifyError(result.error)}`)
        }
        const subtitleData = result.data.map(node => ({
          type: 'cue',
          data: {
            ...node,
            start: srtTimestampToMs(node.start),
            end: srtTimestampToMs(node.end),
          },
        } as const))

        const srtContent = subtitle.stringifySync(subtitleData, { format: 'SRT' })

        this.logger.debug('Uploading SRT file')

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Send JSON body { "accountId": "<id>" } with Content-Type: application/json.
  2. Verify the payload key is exactly accountId (camelCase), not account_id.
  3. Confirm the request is not sent as form-data/text where the body decorator yields undefined.

Example fix

// before
await api.post('/plat/tiktok/auth/revoke', { account_id: id });
// after
await api.post('/plat/tiktok/auth/revoke', { accountId: id }, { headers: { 'Content-Type': 'application/json' } });
Defensive patterns

Strategy: validation

Validate before calling

const body = { accountId };
if (!body.accountId) throw new Error('accountId是必须的');
await api.post('/plat/tiktok/auth/revoke', body, { headers: { 'Content-Type': 'application/json' } });

Type guard

function isRevokeBody(v): v is { accountId: string } {
  return typeof v === 'object' && v !== null && typeof (v as any).accountId === 'string' && (v as any).accountId.length > 0;
}

Try / catch

try {
  await api.post('/plat/tiktok/auth/revoke', { accountId });
} catch (e) {
  if (e.response?.status === 400) console.error('请求体缺少accountId,检查序列化与Content-Type');
  throw e;
}

Prevention

When it happens

Trigger: POST to the revoke-auth route with a body that lacks accountId, sends { "accountId": "" }, or sends form-encoded data the JSON body parser doesn't pick up.

Common situations: Client forgets Content-Type: application/json so @Body('accountId') is undefined, payload key mismatch (e.g. account_id vs accountId), or the disconnect flow passes the wrong object to the API wrapper.

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


AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31). Data as JSON: /api/errors/9c3a8f79b7a121b3. Report an issue: GitHub.