amark/gun · error

Your user account is not published for dApps to access, plea

Error message

Your user account is not published for dApps to access, please consider syncing it online, or allowing local access by adding your device as a peer.

What it means

During gun.user.auth, SEA resolves the user's public key by looking up '~@alias'. When the authenticated pair's pub (act.name set) cannot be found in the graph via the fallback peer lookup (get was undefined, u === get), the library reports that the account is not visible to dApps — the user's account data is not published/replicated so the app cannot access it.

Source

Thrown at sea/auth.js:34

        (cb || noop)({err: Gun.log("User is already being created or authenticated!"), wait: true});
        return gun;
      }
      cat.ing = true;
      
      var act = {}, u;
      act.a = function(data){
        if(!data){ return act.b() }
        if(!data.pub){
          var tmp = []; Object.keys(data).forEach(function(k){ if('_'==k){ return } tmp.push(data[k]) })
          return act.b(tmp);
        }
        if(act.name){ return act.f(data) }
        act.c((act.data = data).auth);
      }
      act.b = function(list){
        var get = (act.list = (act.list||[]).concat(list||[])).shift();
        if(u === get){
          if(act.name){ return act.err('Your user account is not published for dApps to access, please consider syncing it online, or allowing local access by adding your device as a peer.') }
          if(alias && retries--){
            root.get('~@'+alias).once(act.a);
            return;
          }
          return act.err('Wrong user or password.') 
        }
        root.get(get).once(act.a);
      }
      act.c = function(auth){
        if(u === auth){ return act.b() }
        if('string' == typeof auth){ return act.c(obj_ify(auth)) } // in case of legacy
        SEA.work(pass, (act.auth = auth).s, act.d, act.enc); // the proof of work is evidence that we've spent some time/effort trying to log in, this slows brute force.
      }
      act.d = function(proof){
        SEA.decrypt(act.auth.ek, proof, act.e, act.enc);
      }
      act.e = function(half){
        if(u === half){

View on GitHub (pinned to 552227599d)

Solutions

  1. Add your device as a peer of the node holding the account (gun opt peers) so the account data is reachable
  2. Sync the account online once so '~@alias' and '~pub' data are published to peers
  3. Pass the correct SEA key pair via gun.user().auth(pair) so act.name is set and the local account is used
  4. Verify peer connectivity (gun.opt({peers}) URLs) and that the alias lookup '~@'+alias resolves

Example fix

// before — isolated gun, no peers, local account invisible
const gun = Gun();
gun.user().auth(alias, pass);
// after
const gun = Gun({ peers: ['https://your-gun-peer.example.com/gun'] });
gun.user().auth(alias, pass, ack => { if (ack.err) console.error(ack.err); });
Defensive patterns

Strategy: fallback

Validate before calling

const gun = Gun({ peers: ['https://relay.example.com/gun'] });
gun.get('~@' + alias).once(data => {
  if (!data) console.warn('account not published to peers; auth will fail');
});

Type guard

const hasPeers = (g) => Array.isArray(g._.opt && g._.opt.peers) && g._.opt.peers.length > 0;

Try / catch

gun.user().auth(alias, pass, ack => {
  if (ack && ack.err) {
    if (String(ack.err).includes('not published')) {
      // add peer / sync account, then retry auth
    }
    return;
  }
});

Prevention

When it happens

Trigger: Logging in (user.auth) with credentials whose account record exists only on a device not connected as a peer, and the graph lookup for the user's '~' pub node returns nothing (act.list exhausted, get === u) while act.name is set; calling auth against peers that do not have the user's account synced.

Common situations: Developing locally with no peers and an account created but never 'synced online'; switching devices without migrating the SEA key pair; firewall/offline environments where the dApp cannot reach the peer holding the account; test environments with isolated gun instances.

Related errors


AI-assisted analysis of amark/gun@552227599d (2026-09-02). Data as JSON: /api/errors/96d0b93570c177bb. Report an issue: GitHub.