mihomo-party-org/clash-party · error
Empty URL
Error message
Empty URL
What it means
createProfile handles local profiles by writing the provided file content directly; for remote profiles ('type' not 'local') it requires item.url. If a remote profile is created without a URL, it throws 'Empty URL' before any network activity.
Source
Thrown at src/main/config/profile.ts:453
override: item.override || [],
useProxy: item.useProxy || false,
allowFixedInterval: item.allowFixedInterval || false,
autoUpdate: item.autoUpdate ?? false,
authToken: item.authToken,
userAgent: item.userAgent,
ageSecretKey: item.ageSecretKey,
updated: new Date().getTime(),
updateTimeout: item.updateTimeout
}
// Local
if (newItem.type === 'local') {
await setProfileStr(id, item.file || '')
return newItem
}
// Remote
if (!item.url) throw new Error('Empty URL')
const profileUrl = item.url
await profileLogger.info(
`Creating/updating remote profile id=${id} name=${newItem.name} url=${redactSubscriptionUrl(
profileUrl
)} useProxy=${newItem.useProxy} substore=${newItem.substore}`
)
const dedupKey = `${id}::${profileUrl}`
const existing = inflightRemoteFetches.get(dedupKey)
if (existing) {
await profileLogger.info(
`Remote profile fetch deduplicated id=${id} url=${redactSubscriptionUrl(profileUrl)}`
)
return existing
}
const promise = (async (): Promise<IProfileItem> => {
const { userAgent, subscriptionTimeout = 30000 } = await getAppConfig()View on GitHub (pinned to 911e090537)
Solutions
- Provide a non-empty item.url when creating a remote profile.
- Set item.type to 'local' if you intend to import from a file instead.
- Validate the form/input before calling createProfile.
Example fix
// before
await createProfile({ name: 'my-sub', type: 'remote' })
// after
await createProfile({ name: 'my-sub', type: 'remote', url: 'https://example.com/sub' }) Defensive patterns
Strategy: validation
Validate before calling
if (item.type !== 'local' && !item.url) {
throw new Error('remote profiles require a url')
}
await createProfile(item) Type guard
function isRemoteProfile(item: Partial<IProfileItem>): item is Partial<IProfileItem> & { url: string } {
return item.type !== 'local' && typeof item.url === 'string' && item.url.length > 0
} Try / catch
try {
await createProfile(item)
} catch (e) {
if (e.message === 'Empty URL') {
// prompt user to enter a subscription URL
}
} Prevention
- Validate required fields in the import UI before submitting.
- Set type:'local' explicitly when importing from a file.
- Write a schema check for IProfileItem fields in scripts that create profiles.
When it happens
Trigger: Calling createProfile with a Partial<IProfileItem> whose type is 'remote' (or omitted/anything other than 'local') and item.url undefined or empty string.
Common situations: Import dialog submitted without pasting a subscription link; automation/script building profile items that forget the url field; UI state bug where the type switched to remote but the url field was cleared.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Subscription failed: Profile missing proxies or providers
- Subscription failed: Profile is not a valid YAML
- Profile "${id}" contains HTML instead of YAML. The subscript
- Failed to parse profile "${id}": ${msg}
- Unsupported ruleset behavior: ${behavior}
AI-assisted analysis of mihomo-party-org/clash-party@911e090537 (2026-08-30).
Data as JSON: /api/errors/aa87b75f0d8045ae.
Report an issue: GitHub.