If the card you sacrifice isn't still in the graveyard as the first ability resolves, it won't be exiled. It won't be a card exiled with Bag of Devouring for the third ability.

Artwork
Loading artwork…
Bag of Devouring
Forgotten Realms Commander · #21 · EN
Nonfoil—Foil—
Card rules
Whenever you sacrifice another nontoken artifact or creature, exile it.
2,
, Sacrifice another artifact or creature: Draw a card.
3,
, Sacrifice this artifact: Roll a d10. Return up to X cards from among cards exiled with this artifact to their owners' hands, where X is the result.
Rare · Illustrated by Sean Murray
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Bag of Devouring's first ability is a triggered ability that happens when you sacrifice permanents, but you can't just sacrifice permanents whenever you want. You need to have some other means to do so, such as activating Bag of Devouring's second ability.