In an errant manner; in a way that strays from the correct path; while wandering or deviating from proper behavior.
From errant (deviating/wandering) + the adverb suffix '-ly'. This adverb form allows description of how someone behaves while erring.
Shakespeare used 'errantly' to describe knights wandering the countryside—the word perfectly captures the romantic but foolish idea of moral wandering dressed up as adventure.
Complete word intelligence in one call. Free tier — 50 lookups/day.