WASHINGTON — An effort to provide emergency aid for American ranchers and farmers reeling from a year of drought, frost and other calamities collapsed on Thursday as members of Congress departed for their five-week August recess, leaving behind a pile of unfinished legislation as they go home to campaign for re-election.

After refusing to consider a sweeping five-year farm measure, House Republican leaders jammed through a short-term $383 million package of loans and grants for livestock producers and a limited number of farmers. The measure passed 223 to 197, a narrow margin for a bill that has an impact on so many states. But Democrats balked in protest over the way the farm legislation has been handled and some Republicans objected to the costs.

Democratic leaders in the Senate, which had already passed a bipartisan five-year bill, refused to take up the House measure, faulting House Republican leaders for failing to consider the broader legislation in time.

“I’m not passing a bill that only covers some producers,” said Senator Debbie Stabenow, Democrat of Michigan, the chairwoman of the Senate Agriculture Committee.