chatwoot/chatwoot · warning

Invalid identifier for ${platform} QR code

Error message

Invalid identifier for ${platform} QR code

What it means

FinishSetup.vue generateQRCode(platform, identifier) warns 'Invalid identifier for <platform> QR code' and returns early when identifier is falsy or only whitespace. The function builds a platform deep-link (wa.me/, m.me/, t.me/) and feeds it to QRCode.toDataURL; without an identifier there is no URL to encode, so the QR image is simply never rendered — no error is thrown to the caller.

Source

Thrown at app/javascript/dashboard/routes/dashboard/settings/inbox/FinishSetup.vue:106

  }

  if (currentInbox.value.web_widget_script) {
    return t('INBOX_MGMT.FINISH.WEBSITE_SUCCESS');
  }

  if (isWhatsAppEmbeddedSignup.value) {
    return `${t('INBOX_MGMT.FINISH.MESSAGE')}. ${t(
      'INBOX_MGMT.FINISH.WHATSAPP_QR_INSTRUCTION'
    )}`;
  }

  return t('INBOX_MGMT.FINISH.MESSAGE');
});

async function generateQRCode(platform, identifier) {
  if (!identifier || !identifier.trim()) {
    // eslint-disable-next-line no-console
    console.warn(`Invalid identifier for ${platform} QR code`);
    return;
  }

  try {
    const platformUrls = {
      whatsapp: id => `https://wa.me/${id}`,
      messenger: id => `https://m.me/${id}`,
      telegram: id => `https://t.me/${id}`,
    };

    const url = platformUrls[platform](identifier);
    const qrDataUrl = await QRCode.toDataURL(url);
    qrCodes[platform] = qrDataUrl;
  } catch (error) {
    // eslint-disable-next-line no-console
    console.error(`Error generating ${platform} QR code:`, error);
    qrCodes[platform] = '';
  }

View on GitHub (pinned to ed230f9bc0)

Solutions

  1. Complete the channel configuration first: attach the WhatsApp phone number / Messenger page / Telegram bot username to the inbox, then revisit the finish-setup step.
  2. If you control the flow, disable or hide the QR section until the identifier exists instead of silently skipping it.
  3. Check the console warn to see which platform is missing its identifier.

Example fix

// before
await generateQRCode('whatsapp', inbox.phone_number);

// after
const id = (inbox.phone_number || '').trim();
if (id) {
  await generateQRCode('whatsapp', id);
} else {
  // show inline 'add a phone number to get a QR code' hint instead of nothing
}
Defensive patterns

Strategy: validation

Validate before calling

// call-site check before asking for a QR code
const id = (inbox?.phone_number || inbox?.bot_username || '').trim();
if (id) {
  await generateQRCode(platform, id);
} else {
  showHint(`${platform} needs a number/username before a QR code can be shown`);
}

Try / catch

try {
  await generateQRCode(platform, identifier);
} catch (error) {
  // generateQRCode itself no-ops on blank identifiers; this catch covers
  // QRCode.toDataURL failures (invalid url, canvas issues)
  console.error(`QR generation failed for ${platform}:`, error);
}

Prevention

When it happens

Trigger: The finish-setup step runs for an inbox whose chosen channel has no phone number / PSID / bot username yet: WhatsApp API inbox created before a number is attached, Messenger page not fully linked, Telegram bot username missing. platformUrls[platform](identifier) would otherwise throw, but the guard short-circuits first.

Common situations: Inbox creation flow completed partially (embedded signup pending); channel record saved with blank identifier fields; testing the finish-setup screen with fixture inboxes lacking identifiers.

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 chatwoot/chatwoot@ed230f9bc0 (2026-08-21). Data as JSON: /api/errors/0ed00ecd830a8929. Report an issue: GitHub.