risingwavelabs/risingwave · error · Error

could not open schema from {filename}

Error message

could not open schema from {filename}

What it means

Error::SchemaFromFile from the JSON decoder error enum wraps a std::io::Error that occurred while opening/reading the schema file. The thiserror_ext::ContextInto derive formats it as "could not open schema from {filename}". It means the file path could not be opened (missing file, permission, IO failure).

Source

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

// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

use std::collections::HashMap;
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,
    },

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Check the filename in the error for typos and verify the path exists relative to the RisingWave process working directory.
  2. Mount or copy the schema file into the container / environment where RisingWave runs.
  3. Fix file permissions so the process user can read the file.
  4. Prefer an http(s):// schema URL if the file lives elsewhere.

Example fix

// before
schema.location = 'file:///etc/risingwave/schema.json'  // file absent in container
// after
copy schema.json into the image and use 'file:///risingwave/schema.json', or use an http URL the cluster can reach
Defensive patterns

Strategy: try-catch

Validate before calling

const fs = require('fs');
if (!fs.existsSync(path) || !fs.statSync(path).isFile()) {
  throw new Error(`schema file not accessible: ${path}`);
}

Try / catch

try {
  let schema = load_schema_from_file(url);
} catch (e) if e.downcast_ref::<Error>() == Some(&Error::SchemaFromFile { .. }) {
  eprintln!("check schema file path/mount: {e}");
}

Prevention

When it happens

Trigger: Loading a JSON schema via a file:// URL where std::fs::File::open fails: path does not exist, no read permission, path is a directory, or other OS-level IO error.

Common situations: Typo in schema file path in the source config; file deleted or moved after config was written; container image lacking the schema file; permission differences between dev and prod environments.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


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