BigPizzaV3/CodexPlusPlus · error

Dream Skin path must not be a symbolic link

Error message

Dream Skin path must not be a symbolic link

What it means

reject_symlink checks symlink_metadata on a Dream Skin path and fails if the path itself is a symbolic link. The library refuses to write, replace, or operate through symlinks so that a malicious or misconfigured link cannot redirect theme writes outside the state directory.

Solutions

  1. Replace the symlink with a real directory: rm the link and let the library re-create the theme directory, or copy the linked content back to a real directory
  2. Reinstall the theme via the library so a fresh physical directory is created
  3. Check the state_dir path itself (dream-skin/... ancestors) for symlinks and flatten them
  4. If you manage themes externally, copy files in/out of a real directory instead of linking

Example fix

# before
ln -s ~/dotfiles/dream-themes/cool-theme ~/.codex-plus/dream-skin/themes/cool-theme
# after
cp -rL ~/dotfiles/dream-themes/cool-theme ~/.codex-plus/dream-skin/themes/cool-theme  # real directory, no symlink
Defensive patterns

Strategy: validation

Validate before calling

fn assert_not_symlink(path: &Path) -> anyhow::Result<()> {
    let md = std::fs::symlink_metadata(path)?;
    if md.file_type().is_symlink() {
        anyhow::bail!("{} is a symlink; replace it with a real directory first", path.display());
    }
    Ok(())
}
// call before save_dream_skin_theme / install for each path you will pass

Type guard

fn is_real_dir(p: &Path) -> bool {
    matches!(std::fs::symlink_metadata(p).map(|m| m.file_type()), Ok(f) if f.is_dir() && !f.is_symlink())
}

Try / catch

match save_dream_skin_theme(state_dir, &draft) {
    Ok(s) => println!("saved {}", s.id),
    Err(e) if e.to_string().contains("symbolic link") => {
        eprintln!("{} is a symlink — replace with a real directory before saving", state_dir.display());
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: save_dream_skin_theme, save_validated_dream_skin_package, or replace_theme_directory is invoked while the state_dir theme path (or the existing target directory) is a symlink — e.g. the user symlinked dream-skin/themes/<id> into a dotfiles repo, or a previous install left a link behind.

Common situations: Developers managing their theme folder via symlinks for sync (Dropbox, dotfiles, stow); a cleanup tool replaced directories with links; a malicious archive contained a symlink entry that got extracted into the themes directory.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/b3772d2dd8114418. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_library.rs:663

fn remove_known_theme_directory(directory: &Path) -> anyhow::Result<()> {
    if !directory.exists() {
        return Ok(());
    }
    ensure_known_theme_directory(directory)?;
    for entry in std::fs::read_dir(directory)? {
        let path = entry?.path();
        std::fs::remove_file(&path)
            .with_context(|| format!("failed to remove {}", path.display()))?;
    }
    std::fs::remove_dir(directory)
        .with_context(|| format!("failed to remove {}", directory.display()))?;
    Ok(())
}

fn reject_symlink(path: &Path) -> anyhow::Result<()> {
    let metadata = std::fs::symlink_metadata(path)?;
    if metadata.file_type().is_symlink() {
        bail!("Dream Skin path must not be a symbolic link");
    }
    Ok(())
}

fn summary_from_draft(
    draft: &DreamSkinThemeDraft,
    active: bool,
    modified: bool,
) -> DreamSkinThemeSummary {
    DreamSkinThemeSummary {
        key: format!("stored:{}", draft.config.id),
        id: draft.config.id.clone(),
        name: draft.config.name.clone(),
        preview_path: draft.image_path.clone(),
        kind: DreamSkinThemeKind::Stored,
        builtin: false,
        active,
        modified,

View on GitHub (pinned to b1ed92e5e4)