René's URL Explorer Experiment


Title: bug: invalid replacement userId tears down current SDK user state · Issue #8288 · formbricks/formbricks · GitHub

Open Graph Title: bug: invalid replacement userId tears down current SDK user state · Issue #8288 · formbricks/formbricks

X Title: bug: invalid replacement userId tears down current SDK user state · Issue #8288 · formbricks/formbricks

Description: Issue Summary bug: invalid replacement userId tears down current SDK user state ## Issue `setUserId` currently tears down the existing SDK user state before validating the replacement `userId` length. This means an invalid oversized repl...

Open Graph Description: Issue Summary bug: invalid replacement userId tears down current SDK user state ## Issue `setUserId` currently tears down the existing SDK user state before validating the replacement `userId` leng...

X Description: Issue Summary bug: invalid replacement userId tears down current SDK user state ## Issue `setUserId` currently tears down the existing SDK user state before validating the replacement `userId` leng...

Opengraph URL: https://github.com/formbricks/formbricks/issues/8288

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: invalid replacement userId tears down current SDK user state","articleBody":"### Issue Summary\n\n\n```text\nbug: invalid replacement userId tears down current SDK user state\n```\n\n\n```md\n## Issue\n\n`setUserId` currently tears down the existing SDK user state before validating the replacement `userId` length.\n\nThis means an invalid oversized replacement `userId` can clear the current valid user even though the new value is rejected.\n\n## Reproduction\n\nCurrent order in `packages/js-core/src/lib/user/user.ts`:\n\n```ts\nif (currentUserId) {\n  tearDown();\n}\n\nconst MAX_USER_ID_LENGTH = 255;\nif (userId.length \u003e MAX_USER_ID_LENGTH) {\n  return okVoid();\n}\n```\n\nExample flow:\n\n```ts\nawait formbricks.setUserId(\"existing-user\");\nawait formbricks.setUserId(\"a\".repeat(256));\n```\n\n## Current behavior\n\n- Existing user state is torn down.\n- The oversized replacement `userId` is rejected.\n- No new user is set.\n- The SDK loses the previously valid user state.\n\n## Expected behavior\n\nThe replacement `userId` should be validated before tearing down the current user.\n\nIf the new `userId` is invalid, the SDK should reject it without clearing the existing valid user state.\n\n## Minimal fix\n\nMove the max-length validation before the `tearDown()` call.\n\nI verified this with a focused regression test:\n\n```bash\nvitest run src/lib/user/tests/user.test.ts\n```\n\nResult after fix:\n\n```text\n1 file passed, 7 tests passed\n```\n\nFocused ESLint also passes for:\n\n```bash\neslint src/lib/user/user.ts src/lib/user/tests/user.test.ts\n```\n\nBranch:\nhttps://github.com/bharathkumar39293/formbricks/tree/fix/sdk-setuserid-validate-before-teardown\n\nSince PR creation is restricted, I’m happy to open a PR if access is enabled, or a maintainer can cherry-pick the commit if preferred.\n```\n\n### Expected Behavior\n\n_No response_\n\n### Other information (incl. screenshots, Formbricks version, steps to reproduce,...)\n\n_No response_\n\n### Your Environment\n\nNone","author":{"url":"https://github.com/bharathkumar39293","@type":"Person","name":"bharathkumar39293"},"datePublished":"2026-06-16T05:43:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/8288/formbricks/issues/8288"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6b966033-0c75-b64f-b258-8cec77e4c60e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAD48:EE93:772A8C:AB6AEE:6A4BB293
html-safe-nonce42294cf33156e0a97153938b8f730010b1c69210babcea3e261c0bd105c5f469
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRDQ4OkVFOTM6NzcyQThDOkFCNkFFRTo2QTRCQjI5MyIsInZpc2l0b3JfaWQiOiI3OTA3NDE1NjMyNzY0NDQ5NDI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7d303c3dc029b186cb4a39d28ecab8f7434b2abc517a4c6351841c5b2b474bac
hovercard-subject-tagissue:4671414699
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/formbricks/formbricks/8288/issue_layout
twitter:imagehttps://opengraph.githubassets.com/177285f48c620b2ce0db78272935d6e9692f4cbd29b3dd6d809c358cbe8b4f46/formbricks/formbricks/issues/8288
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/177285f48c620b2ce0db78272935d6e9692f4cbd29b3dd6d809c358cbe8b4f46/formbricks/formbricks/issues/8288
og:image:altIssue Summary bug: invalid replacement userId tears down current SDK user state ## Issue `setUserId` currently tears down the existing SDK user state before validating the replacement `userId` leng...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebharathkumar39293
hostnamegithub.com
expected-hostnamegithub.com
Noneae1c14875555a1dd92bdef45baa6dd9aa796df891e4e471989f7117fe3139fc1
turbo-cache-controlno-preview
go-importgithub.com/formbricks/formbricks git https://github.com/formbricks/formbricks.git
octolytics-dimension-user_id105877416
octolytics-dimension-user_loginformbricks
octolytics-dimension-repository_id500289888
octolytics-dimension-repository_nwoformbricks/formbricks
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id500289888
octolytics-dimension-repository_network_root_nwoformbricks/formbricks
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release68fba4ebcf15cde644b66de9a06e0a8582279435
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/formbricks/formbricks/issues/8288#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fformbricks%2Fformbricks%2Fissues%2F8288
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fformbricks%2Fformbricks%2Fissues%2F8288
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=formbricks%2Fformbricks
Reloadhttps://github.com/formbricks/formbricks/issues/8288
Reloadhttps://github.com/formbricks/formbricks/issues/8288
Reloadhttps://github.com/formbricks/formbricks/issues/8288
Please reload this pagehttps://github.com/formbricks/formbricks/issues/8288
formbricks https://github.com/formbricks
formbrickshttps://github.com/formbricks/formbricks
Notifications https://github.com/login?return_to=%2Fformbricks%2Fformbricks
Fork 2.4k https://github.com/login?return_to=%2Fformbricks%2Fformbricks
Star 12.5k https://github.com/login?return_to=%2Fformbricks%2Fformbricks
Code https://github.com/formbricks/formbricks
Issues 194 https://github.com/formbricks/formbricks/issues
Pull requests 22 https://github.com/formbricks/formbricks/pulls
Discussions https://github.com/formbricks/formbricks/discussions
Actions https://github.com/formbricks/formbricks/actions
Security and quality 1 https://github.com/formbricks/formbricks/security
Insights https://github.com/formbricks/formbricks/pulse
Code https://github.com/formbricks/formbricks
Issues https://github.com/formbricks/formbricks/issues
Pull requests https://github.com/formbricks/formbricks/pulls
Discussions https://github.com/formbricks/formbricks/discussions
Actions https://github.com/formbricks/formbricks/actions
Security and quality https://github.com/formbricks/formbricks/security
Insights https://github.com/formbricks/formbricks/pulse
Bughttps://github.com/formbricks/formbricks/issues?q=type:"Bug"
bug: invalid replacement userId tears down current SDK user statehttps://github.com/formbricks/formbricks/issues/8288#top
https://github.com/pandeymangg
bugSomething isn't workinghttps://github.com/formbricks/formbricks/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/bharathkumar39293
bharathkumar39293https://github.com/bharathkumar39293
on Jun 16, 2026https://github.com/formbricks/formbricks/issues/8288#issue-4671414699
https://github.com/bharathkumar39293/formbricks/tree/fix/sdk-setuserid-validate-before-teardownhttps://github.com/bharathkumar39293/formbricks/tree/fix/sdk-setuserid-validate-before-teardown
pandeymangghttps://github.com/pandeymangg
bugSomething isn't workinghttps://github.com/formbricks/formbricks/issues?q=state%3Aopen%20label%3A%22bug%22
Bughttps://github.com/formbricks/formbricks/issues?q=type:"Bug"
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.