rustdesk/rustdesk · error

Invalid path

Error message

Invalid path

What it means

Generic sentinel guard in new_read: a DataSource::FilePath whose path is not valid UTF-8 failed conversion via to_str(). This is not a filesystem error — the path never leaves the process; the fault is a non-UTF-8 OsStr path being passed into a JobConfig that requires string paths.

Source

Thrown at libs/base/src/fs.rs:612

    pub fn with_files(mut self, files: Vec<FileEntry>) -> ResultType<Self> {
        self.set_files(files)?;
        Ok(self)
    }

    pub fn new_read(
        id: i32,
        r#type: JobType,
        remote: String,
        data_source: DataSource,
        file_num: i32,
        show_hidden: bool,
        is_remote: bool,
        enable_overwrite_detection: bool,
    ) -> ResultType<Self> {
        log::info!("new read {}", data_source);
        let (files, total_size) = match &data_source {
            DataSource::FilePath(p) => {
                let p = p.to_str().ok_or(anyhow!("Invalid path"))?;
                let files = get_recursive_files(p, show_hidden)?;
                let total_size = files.iter().map(|x| x.size).sum();
                (files, total_size)
            }
            DataSource::MemoryCursor(c) => (Vec::new(), c.get_ref().len() as u64),
        };
        Ok(Self {
            id,
            r#type,
            remote,
            data_source,
            file_num,
            show_hidden,
            is_remote,
            files,
            total_size,
            enable_overwrite_detection,
            ..Default::default()

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Convert the path to a lossy or re-encoded UTF-8 representation before creating the job
  2. Use a path type that preserves non-UTF-8 bytes instead of String
  3. Reject and surface the invalid-path request to the caller
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/base/src/fs.rs:612 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/ced39945cff3ecea. Report an issue: GitHub.