invoke_signed create_account for a PDA: 'An account required by the instruction is missing' means pass the System Program
Symptom: a native Solana program derives a PDA from a base account and calls system_instruction::create_account through invoke_signed, paying from a separate funding signer. Simulation fails with
Error processing Instruction 0: An account required by the instruction is missingThe same code works when the PDA is derived from the funding account itself, which makes it look like a seed problem.
Cause: two independent mistakes in the CPI call, neither about seeds. First, the account slice handed to invoke_signed must contain every account the callee touches — including the System Program itself — and the code passed the seed base account instead. Second, the signers_seeds argument was given an extra entry for the funding account. Only PDAs sign via seeds; a normal on-curve signer's signature already comes from the outer transaction and propagates into the CPI automatically.
Fix:
invoke_signed(
&system_instruction::create_account(funding_acc.key, new_acc.key, lamports, size as u64, program_id),
&[funding_acc.clone(), new_acc.clone(), system_program.clone()], // payer first, system program present
&[seeds], // only the PDA's seeds + bump
)?;Add system_program: &AccountInfo to the helper's parameters and make the caller pass it in the instruction's account list, otherwise it is not available at CPI time at all.
Why the error text misleads: the runtime reports the missing account generically, without naming which program or which key it wanted, so the natural reading is that the new account or the base account was omitted. Whenever a CPI fails this way, first check that the invoked program's own account is in the slice — it is the account that is easiest to forget and never appears in the instruction's own accounts list conceptually.
Source: adapted from a Stack Exchange answer by Fuzzy Yeti (question by Leonid Kabanov), https://solana.stackexchange.com/questions/9439/how-to-pay-for-pda-account-from-another-private-key — CC BY-SA 4.0