{"record":{"id":"c6606607867cd7f2","repo":"strapi/strapi","slug":"invalid-protocol-url-protocol","errorCode":null,"errorMessage":"Invalid protocol \"${url.protocol}\"","messagePattern":"Invalid protocol \"(.+?)\"","errorType":"validation","errorClass":"ProviderValidationError","httpStatus":null,"severity":"error","filePath":"packages/core/data-transfer/src/strapi/providers/remote-destination/index.ts","lineNumber":351,"sourceCode":"    this.#diagnostics?.report({\n      details: {\n        createdAt: new Date(),\n        message,\n        origin: 'remote-destination-provider',\n      },\n      kind: 'warning',\n    });\n  }\n\n  async bootstrap(diagnostics?: IDiagnosticReporter): Promise<void> {\n    this.#diagnostics = diagnostics;\n    const { url, auth } = this.options;\n    const validProtocols = ['https:', 'http:'];\n\n    let ws: WebSocket;\n\n    if (!validProtocols.includes(url.protocol)) {\n      throw new ProviderValidationError(`Invalid protocol \"${url.protocol}\"`, {\n        check: 'url',\n        details: {\n          protocol: url.protocol,\n          validProtocols,\n        },\n      });\n    }\n    const wsProtocol = url.protocol === 'https:' ? 'wss:' : 'ws:';\n    const wsUrl = `${wsProtocol}//${url.host}${trimTrailingSlash(\n      url.pathname\n    )}${TRANSFER_PATH}/push`;\n\n    this.#reportInfo('establishing websocket connection');\n    // No auth defined, trying public access for transfer\n    if (!auth) {\n      ws = await connectToWebsocket(wsUrl, undefined, this.#diagnostics);\n    }\n","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/strapi/strapi/blob/4a4101264d7098754df36e85fa629fd2f2349d8c/packages/core/data-transfer/src/strapi/providers/remote-destination/index.ts#L333-L369","documentation":"Thrown by bootstrap() in the remote destination provider if options.url.protocol is not 'http:' or 'https:'. The provider derives the WebSocket protocol from this (wss: from https:, ws: from http:), so only HTTP(S) URLs are valid. It is a ProviderValidationError with check: 'url'.","triggerScenarios":"Passing a URL with protocol 'ftp:', 'file:', 'ws:', 'wss:', or an empty protocol. Passing a string that was not parsed into a URL object with a protocol. Constructing a URL without a scheme (e.g., new URL('remote-strapi.example.com')).","commonSituations":"User enters a URL without the https:// prefix in the CLI. A configuration value stored as a bare hostname. Passing a ws:// or wss:// URL directly (the provider expects http/https and derives ws/wss internally).","solutions":["Ensure the URL includes the http:// or https:// scheme (e.g., new URL('https://remote-strapi.example.com')).","Do not pass ws:// or wss:// — the provider converts http→ws and https→wss automatically.","Validate the URL protocol before constructing the provider."],"exampleFix":"// before\nconst provider = createRemoteStrapiDestinationProvider({\n  url: new URL('wss://remote-strapi.example.com'), // wrong protocol\n  strategy: 'restore',\n});\n// after\nconst provider = createRemoteStrapiDestinationProvider({\n  url: new URL('https://remote-strapi.example.com'),\n  strategy: 'restore',\n});","handlingStrategy":"validation","validationCode":"function validateTransferUrl(url: URL): void {\n  const validProtocols = ['https:', 'http:'];\n  if (!validProtocols.includes(url.protocol)) {\n    throw new Error(\n      `URL protocol must be http: or https: (got \"${url.protocol}\"). Do not use ws:/wss:.`\n    );\n  }\n}\n\nconst url = new URL(rawUrlString);\nvalidateTransferUrl(url);","typeGuard":"function isHttpUrl(url: URL): boolean {\n  return url.protocol === 'http:' || url.protocol === 'https:';\n}","tryCatchPattern":"try {\n  await provider.bootstrap();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid protocol')) {\n    console.error('Use http:// or https:// in the transfer URL.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always include the scheme (https://) in the URL string before constructing new URL().","Do not pass ws:// or wss:// — the provider derives WebSocket protocol internally.","Validate the URL protocol before constructing the remote provider."],"tags":["data-transfer","remote","url","validation","websocket"],"backgroundTag":null,"analyzedSha":"4a4101264d7098754df36e85fa629fd2f2349d8c","analyzedAt":"2026-08-12T12:47:50.760Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}