TryGhost/Ghost · warning

The URL must be in a format like https://www.tiktok.com/@you

Error message

The URL must be in a format like https://www.tiktok.com/@yourUsername

What it means

Thrown by the platform-validator engine for the TikTok definition when input is URL-shaped but can't be resolved to a valid tiktok.com profile URL. Message declared in tiktok.ts ('The URL must be in a format like https://www.tiktok.com/@yourUsername'); thrown in platform-validator.ts at: URL regex non-match (line 227 — wrong domain), no path-type match (the @ prefix) or empty remainder (line 233 — e.g. 'https://www.tiktok.com/@' with empty username, or 'https://www.tiktok.com/' missing the @), or built URL failing validator.isURL (line 263). The TikTok path type has urlPrefix '@'.

Source

Thrown at apps/admin/src/settings/app/utils/social-urls/tiktok.ts:12

import {createPlatformValidator} from './platform-validator';

// TikTok usernames are ASCII-only by platform rule: letters, numbers,
// underscores and periods, 2–24 characters, no boundary or consecutive periods.
const tiktok = createPlatformValidator({
    domains: ['tiktok.com'],
    www: true,
    pathTypes: [
        {urlPrefix: '@', storagePrefix: '@', rule: {extra: '._', min: 2, max: 24, notAtBoundary: '.', notConsecutive: '.'}}
    ],
    errors: {
        invalidUrl: 'The URL must be in a format like https://www.tiktok.com/@yourUsername',
        invalidUsername: 'Your Username is not a valid TikTok Username'
    }
});

export const validateTikTokUrl = tiktok.validate;
export const tiktokHandleToUrl = tiktok.handleToUrl;
export const tiktokUrlToHandle = tiktok.urlToHandle;

View on GitHub (pinned to 47d8b0e2ad)

Solutions

  1. Use a URL like https://www.tiktok.com/@yourUsername (note the @) or a bare handle (2–24 chars, letters/digits/._, no boundary or consecutive dots).
  2. Confirm the domain is tiktok.com and the path begins with @.
  3. Ensure the handle after @ isn't empty.
  4. For non-throwing checks, use tiktokUrlToHandle(url) which returns null on invalid input.

Example fix

// before — throws on missing-@ or wrong-domain URL
const normalized = validateTikTokUrl(value);

// after — non-throwing pre-check, then validate
import {tiktokUrlToHandle, validateTikTokUrl} from './tiktok';
const trimmed = value.trim();
try {
    if (trimmed && trimmed.includes('://') && tiktokUrlToHandle(trimmed) === null) {
        setFieldError('tiktok', 'Use https://www.tiktok.com/@yourUsername');
    } else {
        setNormalized(validateTikTokUrl(trimmed));
    }
} catch (e) {
    setFieldError('tiktok', e instanceof Error ? e.message : 'Invalid TikTok URL');
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Non-throwing pre-check using the URL→handle extractor
import {tiktokUrlToHandle} from './tiktok';
function looksLikeTikTokUrl(input: string): boolean {
    if (!input || !input.includes('://')) return true;
    return tiktokUrlToHandle(input) !== null;
}

Type guard

null

Try / catch

try {
    const normalized = validateTikTokUrl(value.trim());
} catch (e) {
    setFieldError('tiktok', e instanceof Error ? e.message : 'Invalid TikTok URL');
}

Prevention

When it happens

Trigger: Input is URL-shaped but: the domain isn't tiktok.com; the path doesn't start with '@' (e.g. 'https://www.tiktok.com/user' — missing the @ marker); the remainder after '@' is empty; or the built canonical URL fails validator.isURL. Bare handles that fail the username rule (2–24 chars, ._ allowed, no boundary/consecutive dots) route to invalidUsername.

Common situations: User pasted a TikTok URL without the @ ('/user/name'); user entered a URL for a different platform; user typed 'https://www.tiktok.com/@' with no handle; URL with characters validator.isURL rejects.

Related errors


AI-assisted analysis of TryGhost/Ghost@47d8b0e2ad (2026-08-13). Data as JSON: /api/errors/5b1a38f8e097241c. Report an issue: GitHub.