linshenkx/prompt-optimizer · error · Error

WebDAV endpoint is required

Error message

WebDAV endpoint is required

What it means

WebDavRemoteObjectStore.baseUrl() requires config.endpoint; every WebDAV request URL is built from it, so an empty endpoint throws immediately.

Source

Thrown at packages/ui/src/utils/remote-backup.ts:1460

        path: childPath,
        sizeBytes: sizeText ? Number(sizeText) : undefined,
        updatedAt: updatedAt ? new Date(updatedAt).toISOString() : undefined,
        contentType,
      })
    }
    return entries
  }

  private authHeaders(): Record<string, string> {
    if (!this.config.username && !this.config.password) return {}
    return {
      Authorization: `Basic ${btoa(`${this.config.username}:${this.config.password}`)}`,
    }
  }

  private baseUrl(): string {
    if (!this.config.endpoint) {
      throw new Error('WebDAV endpoint is required')
    }
    return `${this.config.endpoint.replace(/\/+$/g, '')}/${encodePathSegments(this.config.directory)}/`
  }

  private directoryUrl(path: string): string {
    const encoded = encodePathSegments(path)
    return `${this.baseUrl()}${encoded ? `${encoded}/` : ''}`
  }

  private fileUrl(path: string): string {
    return `${this.baseUrl()}${encodePathSegments(path)}`
  }
}

class DesktopIpcRemoteObjectStore extends BaseRemoteObjectStore {
  provider: RemoteBackupProviderKind

  authorize?: () => Promise<void>

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Set the WebDAV endpoint URL (e.g. https://cloud.example.com/remote.php/dav/files/user) in the provider config
  2. Validate endpoint before saving the config in the UI
  3. Ensure config import/export preserves the endpoint field

Example fix

// before
{ kind: 'webdav', endpoint: '', directory: 'backups', ... }
// after
{ kind: 'webdav', endpoint: 'https://cloud.example.com/remote.php/dav/files/user', directory: 'backups', ... }
Defensive patterns

Strategy: validation

Validate before calling

if (!providerConfig.endpoint?.trim()) blockSave('WebDAV endpoint is required')

Type guard

const isWebDavConfigValid = (c: RemoteBackupProviderConfig): boolean => c.kind !== 'webdav' || Boolean(c.endpoint && c.endpoint.trim())

Prevention

When it happens

Trigger: Configuring a webdav provider without an endpoint field (empty string/undefined) and calling any operation (put/get/list/delete) — all construct URLs via baseUrl().

Common situations: Settings form saved with blank endpoint; migration/import of provider config that dropped the endpoint field; trailing config typos.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/d1c52de336110f7c. Report an issue: GitHub.