{"record":{"id":"5b1a38f8e097241c","repo":"TryGhost/Ghost","slug":"the-url-must-be-in-a-format-like-https-www-tikto","errorCode":null,"errorMessage":"The URL must be in a format like https://www.tiktok.com/@yourUsername","messagePattern":"The URL must be in a format like https://www\\.tiktok\\.com/@yourUsername","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/admin/src/settings/app/utils/social-urls/tiktok.ts","lineNumber":12,"sourceCode":"import {createPlatformValidator} from './platform-validator';\n\n// TikTok usernames are ASCII-only by platform rule: letters, numbers,\n// underscores and periods, 2–24 characters, no boundary or consecutive periods.\nconst tiktok = createPlatformValidator({\n    domains: ['tiktok.com'],\n    www: true,\n    pathTypes: [\n        {urlPrefix: '@', storagePrefix: '@', rule: {extra: '._', min: 2, max: 24, notAtBoundary: '.', notConsecutive: '.'}}\n    ],\n    errors: {\n        invalidUrl: 'The URL must be in a format like https://www.tiktok.com/@yourUsername',\n        invalidUsername: 'Your Username is not a valid TikTok Username'\n    }\n});\n\nexport const validateTikTokUrl = tiktok.validate;\nexport const tiktokHandleToUrl = tiktok.handleToUrl;\nexport const tiktokUrlToHandle = tiktok.urlToHandle;\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/apps/admin/src/settings/app/utils/social-urls/tiktok.ts#L1-L20","documentation":"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 '@'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Confirm the domain is tiktok.com and the path begins with @.","Ensure the handle after @ isn't empty.","For non-throwing checks, use tiktokUrlToHandle(url) which returns null on invalid input."],"exampleFix":"// before — throws on missing-@ or wrong-domain URL\nconst normalized = validateTikTokUrl(value);\n\n// after — non-throwing pre-check, then validate\nimport {tiktokUrlToHandle, validateTikTokUrl} from './tiktok';\nconst trimmed = value.trim();\ntry {\n    if (trimmed && trimmed.includes('://') && tiktokUrlToHandle(trimmed) === null) {\n        setFieldError('tiktok', 'Use https://www.tiktok.com/@yourUsername');\n    } else {\n        setNormalized(validateTikTokUrl(trimmed));\n    }\n} catch (e) {\n    setFieldError('tiktok', e instanceof Error ? e.message : 'Invalid TikTok URL');\n}","handlingStrategy":"try-catch","validationCode":"// Non-throwing pre-check using the URL→handle extractor\nimport {tiktokUrlToHandle} from './tiktok';\nfunction looksLikeTikTokUrl(input: string): boolean {\n    if (!input || !input.includes('://')) return true;\n    return tiktokUrlToHandle(input) !== null;\n}","typeGuard":"null","tryCatchPattern":"try {\n    const normalized = validateTikTokUrl(value.trim());\n} catch (e) {\n    setFieldError('tiktok', e instanceof Error ? e.message : 'Invalid TikTok URL');\n}","preventionTips":["Use https://www.tiktok.com/@yourUsername (note the @) or a bare handle.","Ensure the path begins with @ and the handle after it isn't empty.","Use tiktokUrlToHandle for non-throwing URL checks.","Strip whitespace and trailing slashes before validating."],"tags":["tiktok","social-urls","validation"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}