Skip to content

fix: use -exist flag in ipset add to prevent duplicate entry errors#50293

Open
briancornally wants to merge 1 commit intoanthropics:mainfrom
briancornally:fix/ipset-add-exist-flag
Open

fix: use -exist flag in ipset add to prevent duplicate entry errors#50293
briancornally wants to merge 1 commit intoanthropics:mainfrom
briancornally:fix/ipset-add-exist-flag

Conversation

@briancornally
Copy link
Copy Markdown

Summary

  • Added -exist flag to both ipset add calls in .devcontainer/init-firewall.sh
  • Prevents the script from failing with a "set entry already exists" error if run more than once or if IPs overlap
  • Also removes trailing whitespace on line 82

Test plan

  • Run init-firewall.sh once — verify it completes successfully
  • Run init-firewall.sh a second time — verify it no longer errors on duplicate ipset entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tandon added a commit to tandon/claude-code that referenced this pull request Apr 22, 2026
In the container, dig(1) can return duplicate A records for certain domains due to CNAME chain expansion. This causes ipset(8) to fail, and since set -e is set, abort the entire firewall setup, preventing the dev container from starting.

Previous proposals (anthropics#50293, anthropics#42701) address this in two places by adding --exist to ipset add. My proposal addresses the root cause in one line by deduplicating dig output before it reaches ipset(8).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants