risingwavelabs/risingwave · error · Error

parse error for url {url}

Error message

parse error for url {url}

What it means

Error::UrlParse wraps url::ParseError when the schema location string cannot be parsed as a URL. It is raised before any fetch happens, so it indicates a malformed schema URL rather than a network or schema problem.

Source

Thrown at src/connector/codec/src/decoder/json/mod.rs:56

use std::fs;

use anyhow::{Context, anyhow};
use risingwave_common::catalog::Field;
use risingwave_common::util::panic::rw_catch_unwind;
use serde_json::Value;
use thiserror::Error;
use url::Url;

use super::avro::{MapHandling, avro_schema_to_fields};

#[derive(Debug, Error, thiserror_ext::ContextInto)]
pub enum Error {
    #[error("could not open schema from {filename}")]
    SchemaFromFile {
        filename: String,
        source: std::io::Error,
    },
    #[error("parse error for url {url}")]
    UrlParse {
        url: String,
        source: url::ParseError,
    },
    #[error("schema from {url} not valid JSON")]
    SchemaNotJson { url: String, source: std::io::Error },
    #[error("request error")]
    Request { url: String, source: reqwest::Error },
    #[error("schema from {url} not valid JSON")]
    SchemaNotJsonSerde {
        url: String,
        source: serde_json::Error,
    },
    #[error(
        "ref `{ref_string}` cannot be resolved as a pointer, and `{ref_fragment}` cannot be found in the schema"
    )]
    JsonRefPointerNotFound {
        ref_string: String,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Add an explicit scheme: file:// for local paths, http:// or https:// for remote schema registries.
  2. URL-encode special characters (spaces, #, ?) in the path.
  3. Check environment variable expansion did not leave an empty or partial URL.

Example fix

// before
schema.location = 'localhost:8081/schemas/ids/1'
// after
schema.location = 'http://localhost:8081/schemas/ids/1'
Defensive patterns

Strategy: validation

Validate before calling

try {
  new URL(schemaLocation);
} catch (e) {
  throw new Error(`schema location is not a valid URL: ${schemaLocation}`);
}

Type guard

function isAbsoluteUrl(s) { try { const u = new URL(s); return !!u.protocol; } catch { return false; } }

Prevention

When it happens

Trigger: Passing a schema location that is not a valid URL to the JSON schema loader (e.g. missing scheme like 'localhost/schema.json', illegal characters, or an empty string).

Common situations: Forgetting file:// or http:// prefix; unencoded spaces or special characters in paths; truncated URL from environment variable substitution.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/728b9600e98cecf7. Report an issue: GitHub.