TryGhost/Ghost · warning
The URL must be in a format like https://www.linkedin.com/in
Error message
The URL must be in a format like https://www.linkedin.com/in/yourUsername
What it means
Thrown by the platform-validator engine for the LinkedIn definition when input is URL-shaped but can't be resolved to a valid linkedin.com profile URL. Message declared in linkedin.ts ('The URL must be in a format like https://www.linkedin.com/in/yourUsername'); thrown in platform-validator.ts at: URL regex non-match (line 227 — wrong domain), no recognised path-type prefix (in/, pub/, company/, school/) or empty remainder (line 233 — e.g. 'https://www.linkedin.com/' with no path), or built URL failing validator.isURL (line 263).
Source
Thrown at apps/admin/src/settings/app/utils/social-urls/linkedin.ts:28
min: 3,
max: 100
};
// /in/ profiles are stored as a bare handle; the other path types keep their
// prefix in storage. Regional subdomains (uk.linkedin.com) are valid input and
// stay in the validated URL, but are dropped from the stored handle.
const linkedin = createPlatformValidator({
domains: ['linkedin.com'],
www: true,
regionalSubdomain: '[a-z]{2}',
pathTypes: [
{urlPrefix: 'in/', storagePrefix: '', handleAliases: ['in/'], rule: LINKEDIN_USERNAME_RULE},
{urlPrefix: 'pub/', storagePrefix: 'pub/', rule: {...LINKEDIN_USERNAME_RULE, nestedSegments: true}},
{urlPrefix: 'company/', storagePrefix: 'company/', rule: LINKEDIN_USERNAME_RULE},
{urlPrefix: 'school/', storagePrefix: 'school/', rule: LINKEDIN_USERNAME_RULE}
],
errors: {
invalidUrl: 'The URL must be in a format like https://www.linkedin.com/in/yourUsername',
invalidUsername: 'Your Username is not a valid LinkedIn Username'
}
});
export const validateLinkedInUrl = linkedin.validate;
export const linkedinHandleToUrl = linkedin.handleToUrl;
export const linkedinUrlToHandle = linkedin.urlToHandle;
View on GitHub (pinned to 47d8b0e2ad)
Solutions
- Use a profile URL with one of the recognised prefixes: https://www.linkedin.com/in/yourUsername, /pub/name/..., /company/name, or /school/name.
- Confirm the domain is linkedin.com (regional subdomains like uk.linkedin.com are accepted).
- Ensure the path segment after the prefix isn't empty — 'https://www.linkedin.com/in/' alone throws invalidUrl.
- For non-throwing checks, use linkedinUrlToHandle(url) which returns null on invalid input.
Example fix
// before — throws on non-profile LinkedIn URL
const normalized = validateLinkedInUrl(value);
// after — non-throwing pre-check, then validate
import {linkedinUrlToHandle, validateLinkedInUrl} from './linkedin';
const trimmed = value.trim();
try {
if (trimmed && trimmed.includes('://') && linkedinUrlToHandle(trimmed) === null) {
setFieldError('linkedin', 'Use a profile URL: linkedin.com/in/, /pub/, /company/, or /school/');
} else {
setNormalized(validateLinkedInUrl(trimmed));
}
} catch (e) {
setFieldError('linkedin', e instanceof Error ? e.message : 'Invalid LinkedIn URL');
} Defensive patterns
Strategy: try-catch
Validate before calling
// Non-throwing pre-check using the URL→handle extractor
import {linkedinUrlToHandle} from './linkedin';
function looksLikeLinkedInUrl(input: string): boolean {
if (!input || !input.includes('://')) return true;
return linkedinUrlToHandle(input) !== null;
} Type guard
null
Try / catch
try {
const normalized = validateLinkedInUrl(value.trim());
} catch (e) {
setFieldError('linkedin', e instanceof Error ? e.message : 'Invalid LinkedIn URL');
} Prevention
- Use a profile URL with /in/, /pub/, /company/, or /school/ on linkedin.com.
- Ensure the path segment after the prefix isn't empty.
- Use linkedinUrlToHandle for non-throwing URL checks.
- Regional subdomains (uk.linkedin.com) are accepted; other malformed hosts are not.
When it happens
Trigger: Input is URL-shaped but: the domain isn't linkedin.com (e.g. 'https://facebook.com/in/user'); the path doesn't start with one of in/, pub/, company/, school/ (e.g. 'https://www.linkedin.com/feed'); the path is empty ('https://www.linkedin.com/'); the assembled canonical URL fails validator.isURL. Bare non-URL handles with bad charset route to invalidUsername instead. A regional subdomain (two-letter country code like 'uk.') is captured and kept.
Common situations: User pasted a LinkedIn company/feed/post URL instead of a profile URL; user entered a URL for a different platform; URL missing the required /in/, /pub/, /company/, or /school/ segment; regional LinkedIn URL with an unexpected subdomain.
Related errors
- Your Username is not a valid LinkedIn Username
- The URL must be in a format like @username@instance.tld or h
- Your Username is not a valid Mastodon Username
- The URL must be in a format like https://x.com/yourUsername
- Your Username is not a valid Twitter Username
AI-assisted analysis of TryGhost/Ghost@47d8b0e2ad (2026-08-13).
Data as JSON: /api/errors/474f55ffe65faad1.
Report an issue: GitHub.