Nodes/ComfyUI-MDSNodes/MetaData Remove
ComfyUI Node

MetaData Remove

Delete one field from a Key [Value] chain without rebuilding it

By MarwanDSAI·Created 3 months ago·Updated about 15 hours ago· 3
MetaData Remove
    • METADATA
    ◄metadata►
    ◄key►

    Appending metadata is easy. Taking a field back out is the case nobody designs for, which is why this node exists in the pack at all - and it's exactly what you need when a shared template carries fields your run doesn't earn.

    What it's for

    You inherit a template - the pack's own hub nodes generate metadata automatically, and so do half the comparison workflows floating around - and it stamps Refiner [none] or LoRA [off] whether or not you used either. Your outputs then carry fields that are technically true and practically misleading.

    Or the reverse: a field's value is right at the start of the graph and wrong by the end, because something downstream changed the sampling. You want your own honest line, not the stale one plus yours.

    Either way the fix is the same: take the entry out of the chain and put your own back in. Set up as remove-then-append, it's a two-node patch that keeps the rest of the template's metadata intact - which matters, because the fields you did earn are the ones CivitAI and your future self will read.

    How it works

    Two required inputs:

    • metadata - the string to edit, forced to be a wire (no text box).
    • key - the key name to strip.

    One output: METADATA (STRING), with the entry gone.

    The mechanism is string surgery, and knowing it saves you debugging. The node splits the chain on ;, strips each token, and keeps every token that does not start with key followed by a space and an opening bracket. Then it re-joins what's left with "; ".

    Three consequences follow directly from that:

    Key matching is exact and case-sensitive. Model won't remove model. It also won't remove ModelHash, because the comparison includes the [ after the key - so a prefix collision is genuinely handled, which is more than you'd expect from a node doing this.

    A ; inside a value breaks the entry list. Values are supposed to be short tokens for exactly this reason; a semicolon makes the splitter see two entries, one of which no longer starts with your key and gets orphaned.

    Output formatting is normalised. Everything is re-joined as Key [Value] with a single ; between entries, so any creative spacing in the input is gone.

    Empty inputs are safe: no metadata returns an empty string, and an empty key returns the string unchanged rather than eating the whole chain.

    Installing it

    ComfyUI-MDSNodes by MarwanDSAI. ComfyUI Manager: search ComfyUI-MDSNodes or MDSNodes, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
    # restart ComfyUI
    

    No pip installs, nothing to download - the repo's requirements.txt is empty and the README states the pack needs nothing beyond standard ComfyUI dependencies.

    Search MetaData Remove; it's in MDSNodes/MetaData with the append and extract nodes.

    Common issues

    The field is still there. Case, usually. LoRA and lora are different keys to this node. Check the exact spelling in the chain - pipe the metadata into a preview node and read it, since the strings are easy to typo invisibly.

    You removed it and the whole chain came back flattened. Formatting normalisation, as described above. The entries survive; the original spacing doesn't. If a downstream consumer was parsing on something other than ; , that's your break.

    Half an entry survived. A value with a ; in it, split into two tokens where only one matched the prefix test. Keep values free of semicolons and brackets.

    You removed a key and the value is still in the saved image. Two different things: this node edits a string you're passing around. The embedded workflow chunk in the PNG is written by ComfyUI's save node from the graph itself, and nothing in this pack can take that out. Different layer entirely - see the metadata conventions on which chunk is which.

    CategoryMDSNodes/MetaData

    Inputs (2)

    NameTypeDefaultDescription
    metadataSTRINGThe metadata string to remove the entry from.
    keySTRINGThe key name to find and remove.

    Outputs (1)

    NameTypeDescription
    METADATASTRINGThe metadata string with the specified key removed.