Skip to content

Global install failed when ~/.config/opencode is symlink #89

@minyk

Description

@minyk

Thanks for your works!

I'm managing my opencode config directory with symlink for more visible location(~/IdeaProjects/opencode-config).

In this case, during install, atomic move fail and error.code is ENOTDIR and not match in the installer code:

      if (error.code === 'EXDEV') {
        // Cross-device move needed
        this.logger.debug('Cross-device move detected, using copy+delete');
        await this._crossDeviceMove(tempDir, targetDir);
      } else if (error.code === 'ENOTEMPTY' || error.code === 'EEXIST' || error.code === 'EPERM') {
        // Target exists with other files - MERGE instead of replace
        // This preserves existing opencode configuration
        // NOTE: On Windows, fs.rename throws EPERM instead of ENOTEMPTY/EEXIST
        // when target directory exists. Fixed: 2026-02-26
        this.logger.debug('Target exists with existing files, merging contents');
        await this._mergeDirectories(tempDir, targetDir);
        // Clean up temp directory after merge
        await fs.rm(tempDir, { recursive: true, force: true });
      } else {
        throw error;
      }

I'm not sure this could be handled, not a big problem, just a minor.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions