Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Empty config.json fails closed and blanks usage; a missing file does not

Closed Beginner friendly
#4,071 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
swift
Domain
cli, tooling

Research direction

Start in Sources/CodexBarCore/Config/CodexBarConfigStore.swift, focusing on load() and loadOrCreateDefault(). Add a store regression test covering missing, zero-byte, and whitespace-only files, while confirming that {"providers": still throws decodeFailed; done means empty files follow the missing-file path and partial files are not rewritten.

Written by the indexing model from the issue text.

Description

clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster P2

What happens

A missing CodexBar config validates and does not block usage. A zero-byte or whitespace-only file at the resolved path does not. config validate exits 1, and usage returns a config error instead of provider data.

Reproduced with the installed Linux CLI, against an isolated CODEXBAR_CONFIG so the real config was not touched:

  • missing file: codexbar config validate prints Config: OK and exits 0
  • zero-byte file: Error: Failed to decode CodexBar config: The operation could not be completed. The data isn’t in the correct format. and exits 1
  • whitespace-only file: same decode error, exit 1
  • codexbar usage --format json --provider grok --json-only against the zero-byte file returns a kind: config error and no provider usage

A one-byte partial document ({) also fails decode. That case should keep failing closed.

Where

Current main (efe690450e46f8d51413b04b149786ab717afaf6), Sources/CodexBarCore/Config/CodexBarConfigStore.swift:

load() returns nil only when the file does not exist. If the file exists, it always decodes. There is no zero-byte or whitespace short-circuit before CodexBarConfig.decode(from:).

I did not find an open issue for this. No Swift toolchain here, so I did not open a patch.

Contract

  • zero-byte, or whitespace-only, config at the resolved path should take the same path as a missing file
  • non-empty invalid JSON must still fail closed, and must not be replaced with defaults
  • loadOrCreateDefault() must not rewrite a partial file

A regression can be a store test: missing file loads as nil; zero-byte loads as nil; {"providers": still throws decodeFailed.

Dominant language
Swift
Stars
21.9k
Forks
2k
Avg merge
22h 13m
Merged PRs (30d)
443

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from steipete/CodexBar

All issues in steipete/CodexBar

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.