Is "previousblockhash" always returned from getblock RPC calls? Does the getblock(hash) RPC call always return a "previousblockhash" field and if not: under what conditions does it not return this?

Background: many algorithms suggest using this field as a way to step back in the blockchain when an orphan or reorganization occurs but the C++ code would indicate this field isn't always present.

if (blockindex-&gt;pprev)
        result.push_back(Pair("previousblockhash", blockindex-&gt;pprev-&gt;GetBlockHash().GetHex()));


Would that be due to chain reorganizations and orphans? Can anyone explain what dynamics would make this check fail and what the next step would be if it does?
It will only ever not be present for the genesis block.

A block is not added to the block index until all its ancestors are in there too.

The block index is conceptually a tree: every block can have multiple decendents but only one ancestor. A reorganization is switching from one branch of the tree to another, and does not affect this.

Orphan blocks (in the meaning of blocks without known parent) don't exist anymore since Bitcoin Core 0.10 (we only download blocks after validating their headers, so the parent is never unknown), and even before that, orphan blocks were just stored in a queue in memory and not actually added to the index until their parents were found.