plandex-ai/plandex · error

error reading .plandexignore file

Error message

error reading .plandexignore file: %s

What it means

GetPlandexIgnore loads and compiles the .plandexignore file for a directory. If the file exists (os.Stat succeeds) but ignore.CompileIgnoreFile fails to parse it, this error wraps the underlying parse error and aborts path resolution in GetPaths.

Solutions

  1. Fix the invalid pattern syntax in .plandexignore (check the wrapped err message for the offending line)
  2. Temporarily rename/move .plandexignore to confirm it is the cause
  3. Check file permissions and encoding (save as plain UTF-8 text)
  4. If the wrapped error is transient I/O, re-run after resolving the filesystem issue

Example fix

// before (.plandexignore)
!**/[unclosed
// after
!**/node_modules
!**/dist
Defensive patterns

Strategy: validation

Validate before calling

ignorePath := filepath.Join(dir, ".plandexignore")
if _, err := os.Stat(ignorePath); err == nil {
    if data, rerr := os.ReadFile(ignorePath); rerr != nil {
        return rerr
    } else if err := validateIgnorePatterns(string(data)); err != nil {
        return fmt.Errorf("invalid .plandexignore: %w", err)
    }
}

Try / catch

ignored, err := GetPlandexIgnore(dir)
if err != nil {
    var perr *fs.PathError
    if errors.As(err, &perr) { /* handle I/O failure */ }
    return fmt.Errorf("plandexignore unavailable: %w", err)
}

Prevention

When it happens

Trigger: A .plandexignore file exists in the project directory but its contents cannot be parsed/compiled by the ignore library (malformed pattern syntax, unreadable permissions causing read failure during compile).

Common situations: Hand-edited .plandexignore with invalid glob syntax (e.g. unterminated bracket patterns); file with weird encoding or binary content; filesystem permission changes after the Stat succeeded.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/1581eb253fb6b873. Report an issue: GitHub.

Appendix: source

Thrown at app/cli/fs/paths.go:359

	return &types.ProjectPaths{
		ActivePaths:    activePaths,
		AllPaths:       allPaths,
		ActiveDirs:     activeDirs,
		AllDirs:        allDirs,
		PlandexIgnored: ignored,
		IgnoredPaths:   ignoredPaths,
		GitIgnoredDirs: gitIgnoredDirs,
	}, nil
}

func GetPlandexIgnore(dir string) (*ignore.GitIgnore, error) {
	ignorePath := filepath.Join(dir, ".plandexignore")

	if _, err := os.Stat(ignorePath); err == nil {
		ignored, err := ignore.CompileIgnoreFile(ignorePath)

		if err != nil {
			return nil, fmt.Errorf("error reading .plandexignore file: %s", err)
		}

		return ignored, nil
	} else if !os.IsNotExist(err) {
		return nil, fmt.Errorf("error checking for .plandexignore file: %s", err)
	}

	return nil, nil
}

func GetBaseDirForContexts(contexts []*shared.Context) string {
	var paths []string

	for _, context := range contexts {
		if context.FilePath != "" {
			paths = append(paths, context.FilePath)
		}
	}

View on GitHub (pinned to e2d772072e)